Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hirak/1973356 to your computer and use it in GitHub Desktop.
Save hirak/1973356 to your computer and use it in GitHub Desktop.
PHPの変数初期化の癖 ref: http://qiita.com/items/2994
<?php
$a['foo'] = 'hogehoge';
var_export($a);
//array(
// 'foo' => 'hogehoge'
//)
<?php
$a[1][2][3] = 'hogehoge';
var_export($a);
/*
array(
1 => array(
2 => array(
3 => 'hogehoge'
)
)
)
*/
<?php
$a;
$a['foo'] = 'hogehoge';
$b=null;
$b['foo'] = 'hogehoge';
<?php
isset($a->b->c->d[123][321]);
empty($a->b->c->d[123][321]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment