kristian_gl Posted April 25, 2010 Share Posted April 25, 2010 Hey guys and girls I need to modify a string that look like this: "yes no yes" into a string that look like this: "NULL, \'yes\', \'no\', \'yes\'" so far I got this code: $arr= $_POST; $string = implode (" ", $arr); $string = ", \'" . $string . "\'"; $string = "NULL" . $string; echo $string; but it's output is: "NULL, \'yes no yes\'" Any help would be much appreciated Kristian Quote Link to comment https://forums.phpfreaks.com/topic/199698-modify-string/ Share on other sites More sharing options...
MartinGr Posted April 25, 2010 Share Posted April 25, 2010 $string = 'NULL'; foreach ( $_POST as $item ) { $string .= " \'$item\'"; } echo $string; Quote Link to comment https://forums.phpfreaks.com/topic/199698-modify-string/#findComment-1048130 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.