php - Search for text in output and use whatever is behind the text -
i wondering how search text (ie: description), , use that's behind text variable (all on same line) in php. needs read external location, php file must ran (the php file reads content mysql database , outputs sort of index)
any appreciated.
edit clarify:
sample input:
lorum ipsum dolor
sample output:
dolor
do mean given string:
lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
$wordtofind = "cupidatat"; $alltextbehindwordtofind = substr($str, strpos($str, $wordtofind)); echo $alltextbehindwordtofind; // outputs: 'cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
or:
$alltextbehindwordtofind = substr($str, strpos($str, $wordtofind) + strlen($wordtofind)); echo $alltextbehindwordtofind; // outputs: ' non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
Comments
Post a Comment