question about string

hi experts,

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

Who is Participating?
ahalyaConnect With a Mentor Commented:

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

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

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.