PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $arr = array( '"vehicleDetailURL":"VehicleDetail/41340652~US","itemId":"56722100","salvage_ID":"41340652","year":"2006","make":"GMC","model":"ENVOY XL","seriesName":"SLT","watchStockNum":false,"isIBuyFastSet":true,"ibN_Sold":false,"ibN_Price":"USD 700","currentBid":"","odometer":"242,817 mi","odobrand":"Not Required/Exempt","transmission":"Automatic","lossType":"Other","runAndDrive":true,"keys":"Key Available","stockNumber":"40851029","branchName":"Tampa North","stateName":"Florida"', '"vehicleDetailURL":"VehicleDetail/40781964~US","itemId":"56692856","salvage_ID":"40781964","year":"2019","make":"INFINITI","model":"QX80","seriesName":"LUXE","watchStockNum":false,"isIBuyFastSet":true,"ibN_Sold":false,"ibN_Price":"USD 8,500","currentBid":"","odometer":"1 mi","odobrand":"Inoperable Digital Dash","transmission":"Automatic","lossType":"Collision","runAndDrive":false,"keys":"","stockNumber":"40293534","branchName":"Atlanta South","stateName":"Georgia"' ); $res = []; foreach ($arr as $json) { $json = "{" . $json . "}"; $res[] = json_decode($json, true); } $keys = ['year', 'make', 'model', 'seriesName', 'ibN_Price']; foreach ($res as $data) { $output = array_intersect_key($data, array_flip($keys)); echo implode(" ", $output), "\n"; /* echo "$data[year] $data[make] $data[model] $data[seriesName] $data[ibN_Price]<br>\n"; */ }
Show:  
Copy Clear