fork download
  1. <?php
  2.  
  3. $v=array(
  4. "Image"=> array (
  5. 0=> array (
  6. "id"=> 150,
  7. "Tags"=> array(
  8. 0=> array (
  9. "id"=> 200,
  10. "text"=>"John Doe",
  11. "left"=> 250,
  12. "top"=> 50,
  13. "url"=> "person.php?id=200" ,
  14. "isDeleteEnable"=> true
  15. ),
  16. 1=> array (
  17. "id"=> 400,
  18. "text"=> "Michael Smith",
  19. "left"=> 420,
  20. "top"=> 45,
  21. "width"=> 120,
  22. "height"=> 120,
  23. "isDeleteEnable"=> true
  24. ),
  25. 2=> array (
  26. "id"=> 500,
  27. "text"=> "Peter Parker" ,
  28. "left"=> 55 ,
  29. "top"=> 40,
  30. "url"=> "person.php?id=500" ,
  31. "isDeleteEnable"=> false
  32. )
  33. )
  34. )
  35. )
  36. );
  37.  
  38. echo "Original Array:" . PHP_EOL;
  39. echo PHP_EOL . "Serialized Version:" . PHP_EOL . serialize($v);
  40.  
Success #stdin #stdout 0.03s 13064KB
stdin
Standard input is empty
stdout
Original Array:
array(1) {
  ["Image"]=>
  array(1) {
    [0]=>
    array(2) {
      ["id"]=>
      int(150)
      ["Tags"]=>
      array(3) {
        [0]=>
        array(6) {
          ["id"]=>
          int(200)
          ["text"]=>
          string(8) "John Doe"
          ["left"]=>
          int(250)
          ["top"]=>
          int(50)
          ["url"]=>
          string(17) "person.php?id=200"
          ["isDeleteEnable"]=>
          bool(true)
        }
        [1]=>
        array(7) {
          ["id"]=>
          int(400)
          ["text"]=>
          string(13) "Michael Smith"
          ["left"]=>
          int(420)
          ["top"]=>
          int(45)
          ["width"]=>
          int(120)
          ["height"]=>
          int(120)
          ["isDeleteEnable"]=>
          bool(true)
        }
        [2]=>
        array(6) {
          ["id"]=>
          int(500)
          ["text"]=>
          string(12) "Peter Parker"
          ["left"]=>
          int(55)
          ["top"]=>
          int(40)
          ["url"]=>
          string(17) "person.php?id=500"
          ["isDeleteEnable"]=>
          bool(false)
        }
      }
    }
  }
}

Serialized Version:
a:1:{s:5:"Image";a:1:{i:0;a:2:{s:2:"id";i:150;s:4:"Tags";a:3:{i:0;a:6:{s:2:"id";i:200;s:4:"text";s:8:"John Doe";s:4:"left";i:250;s:3:"top";i:50;s:3:"url";s:17:"person.php?id=200";s:14:"isDeleteEnable";b:1;}i:1;a:7:{s:2:"id";i:400;s:4:"text";s:13:"Michael Smith";s:4:"left";i:420;s:3:"top";i:45;s:5:"width";i:120;s:6:"height";i:120;s:14:"isDeleteEnable";b:1;}i:2;a:6:{s:2:"id";i:500;s:4:"text";s:12:"Peter Parker";s:4:"left";i:55;s:3:"top";i:40;s:3:"url";s:17:"person.php?id=500";s:14:"isDeleteEnable";b:0;}}}}}