...

View Full Version : add % to a string



kamkam
04-03-2010, 03:27 AM
Hi;
how i can add the '%' to a string ?

for example

astring=6789000 ---> %6%7%8%9%0%0%0%
bstring=98765--->%9%8%7%6%5%

my code as following, it doesn't work


<?php
$check="98888778";
echo str_ireplace('%','',$check);

?>

kbluhm
04-03-2010, 03:45 AM
$check = str_split( $check, 1 );
$check = '%' . implode( '%', $check ) . '%';

kamkam
04-03-2010, 03:48 AM
wonderfull, thanks a lot:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum