pacaman Posted November 26, 2008 Share Posted November 26, 2008 Hi all, this is my first message to this forum. Glad to be here, thanks all from now... I have strings like $a='a:6:{i:0;s:1:"4";i:1;s:1:"8";i:2;s:1:"9";i:3;s:1:"7";i:4;s:1:"15";i:5;s:1:"3";}'; I need to get those 4, 8, 9, 7, 15, 3 numbers to arrray. How can i do that? Link to comment https://forums.phpfreaks.com/topic/134331-solved-how-can-i-do-string-parsing/ Share on other sites More sharing options...
zenag Posted November 26, 2008 Share Posted November 26, 2008 use... unserialize(urldecode(content)) Link to comment https://forums.phpfreaks.com/topic/134331-solved-how-can-i-do-string-parsing/#findComment-699336 Share on other sites More sharing options...
The Little Guy Posted November 26, 2008 Share Posted November 26, 2008 $a='a:6:{i:0;s:1:"4";i:1;s:1:"8";i:2;s:1:"9";i:3;s:1:"7";i:4;s:1:"15";i:5;s:1:"3";}'; preg_match_all('~"([0-9]+)"~',$a,$myArray); echo '<pre>'; print_r($myArray); echo '</pre>'; http://phpsnips.com/test.php Link to comment https://forums.phpfreaks.com/topic/134331-solved-how-can-i-do-string-parsing/#findComment-699338 Share on other sites More sharing options...
zenag Posted November 26, 2008 Share Posted November 26, 2008 unserialize(urldecode(stripslashes(($_GET["content"])))) Link to comment https://forums.phpfreaks.com/topic/134331-solved-how-can-i-do-string-parsing/#findComment-699340 Share on other sites More sharing options...
pacaman Posted November 26, 2008 Author Share Posted November 26, 2008 wow that was really fast reply, thanks @zenag Edit: Ah, thx to @The Little Guy too... Link to comment https://forums.phpfreaks.com/topic/134331-solved-how-can-i-do-string-parsing/#findComment-699343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.