- print_r: documentation ( source)
- rand: documentation ( source)
<?php
$json = new stdClass;
$json->status = 0;
$json->msg='success';
for($i=0;$i<7;$i++){
$json->content[] = (object)[
'shopId'=> rand(1,100),'shopname' => 'SP'.rand(1,10), 'shopcode' => rand(1,4999), 'type' => 'shop','flag' => rand(0,1)];
}
print_r($json);
foreach($json->content as $key=>$row){
echo "shopname = $row->shopname and shopcode = $row->shopcode". PHP_EOL;
}