preg replace - php preg_match_all and preg_replace -
i want encode input values base64 encoded. need help... code is:
$check_hash = preg_match_all('/<input type="text" value="(.*?)">/mis', $ays, $hashtweet); $ays = preg_replace('/<input type="text" value="(.*?)">/', base64_encode($hashtweet[1]), $ays); echo $ays; and page here: http://www.ceay.biz/test/vkmp3/
but dont gives me want. can me?
use preg_replace_callback (requires php 5.3 closure)
$ays = preg_replace_callback('/value="(.*)"/', function ($match) { return "value=\"".base64_encode($match[1])."\""; }, $ays); for pre php 5.3 environments
if (!function_exists("valuereplacer")){ function valuereplacer ($m){ return "value=\"".base64_encode($m[1])."\""; } } $ays = preg_replace_callback('/value="(.*)"/', "valuereplacer", $ays);
Comments
Post a Comment