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 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; Link to comment https://forums.phpfreaks.com/topic/199698-modify-string/#findComment-1048130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.