PHP Extract a String that does not Match a given String of Text
Labels:
php
PHP Extract a String that does not Match a given String of Text
Use explode, to strip and remove a line of text or word that matches "Foo"
$string = "Test Foo Bar";The [0] var gets the char previous to the match
$split = explode("Foo",$string);
$strip0 = $split[0];
$strip1 = $split[1];
echo "$strip0"; => Test
echo "$strip1"; => Bar
The [1] var gets the char after the match
No comments:
Post a Comment