<?php
$string = '[{"id":96,"type":"product","title":"Cassia","code":"CODE-101","fabric":0,"option":"2","options":[["TEst 1","http://localhost/content/uploads/2017/07/seating4-150x150.png"],["Dimension 2","http://localhost/content/uploads/2017/07/seating3-150x150.png"],["Dimension 3","http://localhost/content/uploads/2017/07/seating1-150x150.png"],["Dimension 4","http://localhost/content/uploads/2017/07/seating2-150x150.png"]],"quantity":5},{"id":139,"type":"product","title":"Accent","code":"","fabric":0,"option":0,"options":[["Testing","http://localhost/content/uploads/2017/07/seating3-150x150.png"]],"quantity":13}]';
$decoded = json_decode($string);
var_dump($decoded);
- Output for 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- array(2) {
[0]=>
object(stdClass)#1 (8) {
["id"]=>
int(96)
["type"]=>
string(7) "product"
["title"]=>
string(6) "Cassia"
["code"]=>
string(8) "CODE-101"
["fabric"]=>
int(0)
["option"]=>
string(1) "2"
["options"]=>
array(4) {
[0]=>
array(2) {
[0]=>
string(6) "TEst 1"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating4-150x150.png"
}
[1]=>
array(2) {
[0]=>
string(11) "Dimension 2"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating3-150x150.png"
}
[2]=>
array(2) {
[0]=>
string(11) "Dimension 3"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating1-150x150.png"
}
[3]=>
array(2) {
[0]=>
string(11) "Dimension 4"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating2-150x150.png"
}
}
["quantity"]=>
int(5)
}
[1]=>
object(stdClass)#2 (8) {
["id"]=>
int(139)
["type"]=>
string(7) "product"
["title"]=>
string(6) "Accent"
["code"]=>
string(0) ""
["fabric"]=>
int(0)
["option"]=>
int(0)
["options"]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(7) "Testing"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating3-150x150.png"
}
}
["quantity"]=>
int(13)
}
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
array(2) {
[0]=>
object(stdClass)#1 (8) {
["id"]=>
int(96)
["type"]=>
string(7) "product"
["title"]=>
string(6) "Cassia"
["code"]=>
string(8) "CODE-101"
["fabric"]=>
int(0)
["option"]=>
string(1) "2"
["options"]=>
array(4) {
[0]=>
array(2) {
[0]=>
string(6) "TEst 1"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating4-150x150.png"
}
[1]=>
array(2) {
[0]=>
string(11) "Dimension 2"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating3-150x150.png"
}
[2]=>
array(2) {
[0]=>
string(11) "Dimension 3"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating1-150x150.png"
}
[3]=>
array(2) {
[0]=>
string(11) "Dimension 4"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating2-150x150.png"
}
}
["quantity"]=>
int(5)
}
[1]=>
object(stdClass)#2 (8) {
["id"]=>
int(139)
["type"]=>
string(7) "product"
["title"]=>
string(6) "Accent"
["code"]=>
string(0) ""
["fabric"]=>
int(0)
["option"]=>
int(0)
["options"]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(7) "Testing"
[1]=>
string(61) "http://localhost/content/uploads/2017/07/seating3-150x150.png"
}
}
["quantity"]=>
int(13)
}
}
preferences:
182.19 ms | 405 KiB | 248 Q