I have a piece of code, from this i want to remove some words from string but the trim() function is not showing proper output.
The code is below
<?php
$mystring = '/word-quotes-hope';
$findme = '/word-quotes-';
echo $str = trim($mystring, $findme);
?>
and its output is hop, but it should be hope
Its working example http://codepad.viper-7.com/FxLZkp
Anybody knows why this is happening.
Because
trimuses the second string individual characters, not the whole string, and in your case it has anein it, and the string ends witheso off it goes.