<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', 1); $strArr = [ 'name'=>"test", 'is_feature'=> "0", 'attributes'=>[[5=> "blue"],[7=> "iOS"]], 'cost'=> "2000" ]; $str = json_encode($strArr); $arr = (array) json_decode($str); $att = (array) $arr['attributes']; foreach($att as $v) { foreach($v as $k=>$z) { echo "key: ".$k." and val: " . $z . PHP_EOL; } }; ?> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more