hi guys i am from turkey.i am sorry for my bad english i want to shred to characters in veriable for examle, $variable="Fred love to php"; $variable2=function x($variable); echo $variable2[0]; RESULT "f" ************************************************************************ echo $veriable2[1]; RESULT "r" ***************** i want to spaces
I think I understand what you want... function cleanUp($var) { $bad = array(' ','-','.'); // add in all the stuff you don't want $output = str_replace($bad,'',$var); return $output; } $variable="Fred love to php"; $variable2 = cleanUp($variable); PHP: You can use regex too but I think you might find this simpler.