Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'floydian_play'@'localhost' (using password: YES) in /home/floydian/public_html/play_ground/serialize.php on line 3

Serialized array

a:7:{i:0;a:2:{s:7:"item_id";i:10;s:7:"them_id";i:34;}i:1;a:2:{s:7:"item_id";i:56;s:7:"them_id";i:154;}i:2;a:2:{s:7:"item_id";i:67;s:7:"them_id";i:576;}i:3;a:2:{s:7:"item_id";i:13;s:7:"them_id";i:359;}i:4;a:2:{s:7:"item_id";i:67;s:7:"them_id";i:207;}i:5;a:2:{s:7:"item_id";i:78;s:7:"them_id";i:833;}i:6;a:2:{s:7:"item_id";i:2;s:7:"them_id";i:488;}}


Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/floydian/public_html/play_ground/serialize.php on line 26

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/floydian/public_html/play_ground/serialize.php on line 26

Serialized and db escaped array



Unserialized array

array ( 0 => array ( 'item_id' => 10, 'them_id' => 34, ), 1 => array ( 'item_id' => 56, 'them_id' => 154, ), 2 => array ( 'item_id' => 67, 'them_id' => 576, ), 3 => array ( 'item_id' => 13, 'them_id' => 359, ), 4 => array ( 'item_id' => 67, 'them_id' => 207, ), 5 => array ( 'item_id' => 78, 'them_id' => 833, ), 6 => array ( 'item_id' => 2, 'them_id' => 488, ), )

Unserialize error


Notice: unserialize() [function.unserialize]: Error at offset 0 of 35 bytes in /home/floydian/public_html/play_ground/serialize.php on line 49

Unserialize error suppression

The variable we unserialized couldn't be unserialized, thus the unserialize function outputs: bool(false)

Handling the new variable

$string2 could not be unserialized...

$string2 is not an array...

$unserialized_items was successfully unserialized...

array ( 'item_id' => 10, 'them_id' => 34, )
array ( 'item_id' => 56, 'them_id' => 154, )
array ( 'item_id' => 67, 'them_id' => 576, )
array ( 'item_id' => 13, 'them_id' => 359, )
array ( 'item_id' => 67, 'them_id' => 207, )
array ( 'item_id' => 78, 'them_id' => 833, )
array ( 'item_id' => 2, 'them_id' => 488, )