php - How can I find a special character in my string and store all value after this character in a variable -


this question has answer here:

i trying find special character $@ string , trying store value after these special in variable not task. how find $@ special character in whole string , store value after special charecter in variable. string is:

 92~sapl/1200/2012~2~laxman singh , others~shanker singh , others~d~  2014-04-10~09:31:13  07/04/2014|93~sapl/275/1998~1~ram swaroop , others~babu ram , others~d~  2014-04-10~09:31:13 07/04/2014|94~fafod/52/2013~3~ram kumar pandey~rajendra pandey ,  another~d~2014-04-10~09:31:13 07/04/2014$@2014-04-10~2014-04-09  

try this:

$string = "your entire string"; $explodedstring = explode('$@', $string);  if(count($explodedstring) > 1) {    unset($explodedstring[0]);    $returnstring = count($explodedstring) > 1 ? $explodedstring : $explodedstring[0]; } else {    $returnstring = null; }  if(is_array($returnstring)) {    //if want divide string first occurrence of $@ leave below line else comment out    $returnstring = implode('', $returnstring); }  echo $returnstring; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -