Heim  >  Artikel  >  Backend-Entwicklung  >  [PHP] small example to show dynamic type change_PHP教程

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

WBOY
WBOYOriginal
2016-07-13 10:37:201061Durchsuche

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...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn