How to remove everything from a string from a specific word in PHP

1 Answer

0 votes
$str = 'PHP is a general purpose scripting language';

$str = substr($str, 0, strpos($str, "purpose"));

echo $str;




/*
run:

PHP is a general 

*/

 



answered Dec 6, 2022 by avibootz

Related questions

...