Life is short

PHPの型チェックのメモ

テストコード $f = tempnam(‘/tmp/’,’test’); $testme = array( null, true, false, array(), 0, 1, 0.10, 1.123, ”, ‘0’, ‘1’, ’10’, ‘0.10’, ‘1.123’, ‘1,234,567’, ‘ 1’, ‘1 ‘, ‘ 1 ‘, ‘Hello’, new stdClass(), fopen($f,’w’), ); $result = array(); foreach($testme as $value){ $tmp = array(); $tmp[‘value’] = $value; $tmp[‘isset’] = isset($value); $tmp[‘null’] = is_null($value); $tmp[’empty’] = empty($value); […]


Proudly powered by WordPress