PageRenderTime 13ms CodeModel.GetById 5ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/zend/bad/Zend/tests/empty_str_offset.php

http://github.com/facebook/hiphop-php
PHP | 47 lines | 42 code | 4 blank | 1 comment | 0 complexity | b40c9b4c85c2b09d46147c598fbb0092 MD5 | raw file
 1<?php
 2
 3print "- empty ---\n";
 4
 5$str = "test0123";
 6
 7var_dump(empty($str[-1]));
 8var_dump(empty($str[0]));
 9var_dump(empty($str[1]));
10var_dump(empty($str[4])); // 0
11var_dump(empty($str[5])); // 1
12var_dump(empty($str[8]));
13var_dump(empty($str[10000]));
14// non-numeric offsets
15print "- string ---\n";
16var_dump(empty($str['-1']));
17var_dump(empty($str['0']));
18var_dump(empty($str['1']));
19var_dump(empty($str['4'])); // 0
20var_dump(empty($str['1.5']));
21var_dump(empty($str['good']));
22var_dump(empty($str['3 and a half']));
23print "- bool ---\n";
24var_dump(empty($str[true]));
25var_dump(empty($str[false]));
26var_dump(empty($str[false][true]));
27print "- null ---\n";
28var_dump(empty($str[null]));
29print "- double ---\n";
30var_dump(empty($str[-1.1]));
31var_dump(empty($str[-0.8]));
32var_dump(empty($str[-0.1]));
33var_dump(empty($str[0.2]));
34var_dump(empty($str[0.9]));
35var_dump(empty($str[M_PI]));
36var_dump(empty($str[100.5001]));
37print "- array ---\n";
38var_dump(empty($str[array()]));
39var_dump(empty($str[array(1,2,3)]));
40print "- object ---\n";
41var_dump(empty($str[new stdClass()]));
42print "- resource ---\n";
43$f = fopen(__FILE__, 'r');
44var_dump(empty($str[$f]));
45print "done\n";
46
47?>