揮発性のメモ2

http://d.hatena.ne.jp/iww/

warningを出す

#!/usr/bin/php -q
<?php
    error_reporting(-1);  // ★これが無いと、Warningが出ないことがある
    
    $a->b = "hello";
    $a->c = "world";
    print( "{$a->b},{$a->c}!\n" );
?>
$ ./hoge.php
PHP Strict Standards:  Creating default object from empty value in /tmp/hoge.php on line 5
hello,world!

つまらないwarningもすべて出力させるためには error_reporting(-1); を呼び出すか php.iniで error_reporting -1 を設定する