How to select all characters to the right of a specific character in a string - PHP

I spent a long time trying to figure this out! How do I select all the characters to the right of a specific character in a string when I don't know how many characters there will be?


You can also do:

$str = 'some_long_string';
echo explode( '_', $str, 2)[1]; // long_string

// find the position of the first occurrence of the char you're looking for
$pos = strpos($string, $char);

// cut the string from that point
$result = substr($string, $pos + 1);

I'm not sure this would fit your needs, but :

$string = explode(',','I dont know how to, get this part of the text');

Wouldn't $string[1] always be the right side of the delimiter? Unless you have more than one of the same in the string... sorry if it's not what you're looking for.

Need Your Help

Converting file to Base64 URL safe encoding format in iOS

ios objective-c zip base64 url-encoding

I am supposed to convert a file in to Base64 and add that String to a JSON which I am appending to a URL. The files that I am having are a .zip file and a text file with .info extension. The .info ...

How to reference SMF libraries when deploying on phone 7 (Release)

c# silverlight windows-phone-7 reference

Initially, at Visual Studio, I clicked debug instead of release to deploy my app on phone 7 device. No errors, works perfectly fine!