Reputation:
I'm looking for a really simple of way stripping content from this string:
Example:
/m/NEEDED/
I would like to strip everything except "NEEDED".
Any help would be great, Thanks!
Upvotes: 0
Views: 91
Reputation: 28164
The str_replace()
one is quite specific, and the one I'd use.
But since you mentioned strip()
, it reminded me of trim()
:
echo trim('/m/NEEDED/','/m');
Example: http://codepad.viper-7.com/AcDZCM
Upvotes: 1
Reputation: 5119
<?php
$strip = array("/","m");
echo str_replace($strip,"","text input here");
?>
Add more characters that you want to strip in the array if you want.
Upvotes: 0