question about string

hi experts,

 in $mysting how can I delete every thing after $badpart if found
the $badpart  also must be deleted.

regards,
uk1900Asked:
Who is Participating?
 
ahalyaConnect With a Mentor Commented:

$pos = strpos($mystring, $badpart);
$mystring = substr($mystring, $pos);
0
 
Xyptilon2Connect With a Mentor Commented:
<?PHP

echo "Before: $sMystring <BR>";
$nPosition = strpos($sMystring, $sBadpart);
$sMystring = substr($sMystring, $nPosition );
echo "After: $sMystring <BR>";

?>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.