Get specific values from a string of php -
edited que.. value contains letters
i have search through many questions couldn't find it.
have string this:
ab2cds value=284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134 what want values in output like:
284t810 39h1047 3700p134 i used substr , strpos combine value removes portion of data ahead of first "value=" output like:
284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134 i want delete else , keep numbered value after "value="
sorry if there confusion. using stackoverflow first time.
i updated answer according edit!!
use code: code strings after value=. think easiest solution.
$str = 'b2cds value=284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134'; preg_match_all('#value=([^\s]+)#', $str, $matches); echo implode(' ', $matches[1]); @kesh : \s means space. [^\s] means except space. , + means @ least 1 char. , () around selecting string can use after operation. ([^\s]+) means select except space , put them $matches
Comments
Post a Comment