首页  >  文章  >  后端开发  >  [PHP] small example to show dynamic type change_PHP教程

[PHP] small example to show dynamic type change_PHP教程

WBOY
WBOY原创
2016-07-13 10:37:201061浏览

When you declare one variable, the initial type is null, but the type can be changed by assign statement.

global $my_var;
echo gettype($my_var);

$my_var = new stdClass();
$my_var->name = 'test';
$my_var->city = 'china';

//$my_var['weather']= 'cold';

echo gettype($my_var);
var_dump($my_var);


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/735900.htmlTechArticleWhen you declare one variable, the initial type is null, but the type can be changed by assign statement. global $my_var;echo gettype($my_var);$my_var = new stdClass();$my_var->nam...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn