get string after character php code example

Example 1: get the string after a character in php

$data = "123_String";    
$whatIWant = substr($data, strpos($data, "_") + 1);    
echo $whatIWant;

Example 2: get words after string in in php

$string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla felis diam, mattis id elementum eget, ullamcorper et purus.";
$prefix = "Nulla";
$index = strpos($string, $prefix) + strlen($prefix);
$result = substr($string, $index);

Tags:

Php Example