(object) array
1 <?php 2 $current_language = (object)array 3 ( 4 'name' => '火星文', 5 'timezone' => 'Asia/Tokyo', 6 'author_name' => 'who', 7 'is_beta' => FALSE 8 ); 9 10 var_dump($current_language); 11 echo $current_language->name; 12 die();
1 D:\wamp64\www\wdb.php:10: 2 object(stdClass)[1] 3 public 'name' => string '火星文' (length=9) 4 public 'timezone' => string 'Asia/Tokyo' (length=10) 5 public 'author_name' => string 'who' (length=3) 6 public 'is_beta' => boolean false 7 火星文
<?php $obj = new stdClass(); $obj->w1 = 'ww1'; $obj->w2 = 'ww2'; $obj->w3 = 'ww3'; foreach ($obj AS $key => $val) { var_dump($key); var_dump($val); }
C:\>php D:\cmd\amzapi\amzapitest_com\MarketplaceWebServiceOrders\Samples\wd_learn.php
string(2) "w1"
string(3) "ww1"
string(2) "w2"
string(3) "ww2"
string(2) "w3"
string(3) "ww3"