php - How find words and strip the words after it? -
$string = 'hello world php bla bla..';
how keep 'hello world php', finding if string contains 'is', , remove characters after it?
i can't use substr because occurrence of 'is' not consistent, may repeatable. how catch first one?
you can use explode:
<?php $string = 'hello world php bla bla..'; $string = explode(' ', $string); echo $string[0]; ?>
read more at:
Comments
Post a Comment