From: Raghubansh Kumar Date: Tue, 22 May 2007 16:06:44 +0000 (+0000) Subject: New version of gettype_settype_basic.phpt, gettype_settype_variation3.phpt, gettype_... X-Git-Tag: RELEASE_1_4~96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b609c75148231d5f07bf33b88b7d608ef423d6a4;p=php New version of gettype_settype_basic.phpt, gettype_settype_variation3.phpt, gettype_settype_variation7.phpt, gettype_settype_error.phpt, gettype_settype_variation4.phpt, gettype_settype_variation8.phpt, gettype_settype_variation1.phpt, gettype_settype_variation5.phpt, gettype_settype_variation2.phpt, gettype_settype_variation6.phpt --- diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt new file mode 100644 index 0000000000..52422b5f5b --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt @@ -0,0 +1,1912 @@ +--TEST-- +Test gettype() & settype() functions : basic functionalities +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "Object"; + } +} + +$unset_var = 10; +unset($unset_var); + +$values = array( + array(1,2,3), + $var1, + $var2, + 1, + -20, + 2.54, + -2.54, + NULL, + false, + "some string", + 'string', + b"some string", + b'string', + $fp, + $dfp, + new point(10,20) +); + +$types = array( + "null", + "integer", + "int", + "float", + "double", + "boolean", + "bool", + "resource", + "array", + "object", + "string" +); + +echo "\n*** Testing gettype(): basic operations ***\n"; +foreach ($values as $value) { + var_dump( gettype($value) ); +} + +echo "\n*** Testing settype(): basic operations ***\n"; +foreach ($types as $type) { + echo "\n-- Setting type of data to $type --\n"; + $loop_count = 1; + foreach ($values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count ++; + // set to new type + var_dump( settype($var, $type) ); + + // dump the var + var_dump( $var ); + + // check the new type + var_dump( gettype($var) ); + } +} + +echo "Done\n"; +?> +--EXPECTF-- +**** Testing gettype() and settype() functions **** + +*** Testing gettype(): basic operations *** +string(5) "array" +string(6) "string" +string(5) "array" +string(7) "integer" +string(7) "integer" +string(6) "double" +string(6) "double" +string(4) "NULL" +string(7) "boolean" +string(6) "string" +string(6) "string" +string(6) "string" +string(6) "string" +string(8) "resource" +string(8) "resource" +string(6) "object" + +*** Testing settype(): basic operations *** + +-- Setting type of data to null -- +-- Iteration 1 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 2 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 3 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 4 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 5 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 6 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 7 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 8 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 9 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 10 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 11 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 12 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 13 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 14 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 15 -- +bool(true) +NULL +string(4) "NULL" +-- Iteration 16 -- +bool(true) +NULL +string(4) "NULL" + +-- Setting type of data to integer -- +-- Iteration 1 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 2 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 3 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 4 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 5 -- +bool(true) +int(-20) +string(7) "integer" +-- Iteration 6 -- +bool(true) +int(2) +string(7) "integer" +-- Iteration 7 -- +bool(true) +int(-2) +string(7) "integer" +-- Iteration 8 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 9 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 10 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 11 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 12 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 13 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 14 -- +bool(true) +int(5) +string(7) "integer" +-- Iteration 15 -- +bool(true) +int(6) +string(7) "integer" +-- Iteration 16 -- +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" + +-- Setting type of data to int -- +-- Iteration 1 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 2 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 3 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 4 -- +bool(true) +int(1) +string(7) "integer" +-- Iteration 5 -- +bool(true) +int(-20) +string(7) "integer" +-- Iteration 6 -- +bool(true) +int(2) +string(7) "integer" +-- Iteration 7 -- +bool(true) +int(-2) +string(7) "integer" +-- Iteration 8 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 9 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 10 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 11 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 12 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 13 -- +bool(true) +int(0) +string(7) "integer" +-- Iteration 14 -- +bool(true) +int(5) +string(7) "integer" +-- Iteration 15 -- +bool(true) +int(6) +string(7) "integer" +-- Iteration 16 -- +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" + +-- Setting type of data to float -- +-- Iteration 1 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 2 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 3 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 4 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 5 -- +bool(true) +float(-20) +string(6) "double" +-- Iteration 6 -- +bool(true) +float(2.54) +string(6) "double" +-- Iteration 7 -- +bool(true) +float(-2.54) +string(6) "double" +-- Iteration 8 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 9 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 10 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 11 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 12 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 13 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 14 -- +bool(true) +float(5) +string(6) "double" +-- Iteration 15 -- +bool(true) +float(6) +string(6) "double" +-- Iteration 16 -- +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" + +-- Setting type of data to double -- +-- Iteration 1 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 2 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 3 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 4 -- +bool(true) +float(1) +string(6) "double" +-- Iteration 5 -- +bool(true) +float(-20) +string(6) "double" +-- Iteration 6 -- +bool(true) +float(2.54) +string(6) "double" +-- Iteration 7 -- +bool(true) +float(-2.54) +string(6) "double" +-- Iteration 8 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 9 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 10 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 11 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 12 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 13 -- +bool(true) +float(0) +string(6) "double" +-- Iteration 14 -- +bool(true) +float(5) +string(6) "double" +-- Iteration 15 -- +bool(true) +float(6) +string(6) "double" +-- Iteration 16 -- +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" + +-- Setting type of data to boolean -- +-- Iteration 1 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 2 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 3 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 4 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 5 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 6 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 7 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 8 -- +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 9 -- +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 10 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 11 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 12 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 13 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 14 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 15 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 16 -- +bool(true) +bool(true) +string(7) "boolean" + +-- Setting type of data to bool -- +-- Iteration 1 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 2 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 3 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 4 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 5 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 6 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 7 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 8 -- +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 9 -- +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 10 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 11 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 12 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 13 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 14 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 15 -- +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 16 -- +bool(true) +bool(true) +string(7) "boolean" + +-- Setting type of data to resource -- +-- Iteration 1 -- +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +string(5) "array" +-- Iteration 2 -- +2: settype(): Cannot convert to resource type +bool(false) +string(14) "another string" +string(6) "string" +-- Iteration 3 -- +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +string(5) "array" +-- Iteration 4 -- +2: settype(): Cannot convert to resource type +bool(false) +int(1) +string(7) "integer" +-- Iteration 5 -- +2: settype(): Cannot convert to resource type +bool(false) +int(-20) +string(7) "integer" +-- Iteration 6 -- +2: settype(): Cannot convert to resource type +bool(false) +float(2.54) +string(6) "double" +-- Iteration 7 -- +2: settype(): Cannot convert to resource type +bool(false) +float(-2.54) +string(6) "double" +-- Iteration 8 -- +2: settype(): Cannot convert to resource type +bool(false) +NULL +string(4) "NULL" +-- Iteration 9 -- +2: settype(): Cannot convert to resource type +bool(false) +bool(false) +string(7) "boolean" +-- Iteration 10 -- +2: settype(): Cannot convert to resource type +bool(false) +string(11) "some string" +string(6) "string" +-- Iteration 11 -- +2: settype(): Cannot convert to resource type +bool(false) +string(6) "string" +string(6) "string" +-- Iteration 12 -- +2: settype(): Cannot convert to resource type +bool(false) +string(11) "some string" +string(6) "string" +-- Iteration 13 -- +2: settype(): Cannot convert to resource type +bool(false) +string(6) "string" +string(6) "string" +-- Iteration 14 -- +2: settype(): Cannot convert to resource type +bool(false) +resource(5) of type (stream) +string(8) "resource" +-- Iteration 15 -- +2: settype(): Cannot convert to resource type +bool(false) +resource(6) of type (stream) +string(8) "resource" +-- Iteration 16 -- +2: settype(): Cannot convert to resource type +bool(false) +object(point)#1 (2) { + ["x"]=> + int(10) + ["y"]=> + int(20) +} +string(6) "object" + +-- Setting type of data to array -- +-- Iteration 1 -- +bool(true) +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +string(5) "array" +-- Iteration 2 -- +bool(true) +array(1) { + [0]=> + string(14) "another string" +} +string(5) "array" +-- Iteration 3 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +string(5) "array" +-- Iteration 4 -- +bool(true) +array(1) { + [0]=> + int(1) +} +string(5) "array" +-- Iteration 5 -- +bool(true) +array(1) { + [0]=> + int(-20) +} +string(5) "array" +-- Iteration 6 -- +bool(true) +array(1) { + [0]=> + float(2.54) +} +string(5) "array" +-- Iteration 7 -- +bool(true) +array(1) { + [0]=> + float(-2.54) +} +string(5) "array" +-- Iteration 8 -- +bool(true) +array(0) { +} +string(5) "array" +-- Iteration 9 -- +bool(true) +array(1) { + [0]=> + bool(false) +} +string(5) "array" +-- Iteration 10 -- +bool(true) +array(1) { + [0]=> + string(11) "some string" +} +string(5) "array" +-- Iteration 11 -- +bool(true) +array(1) { + [0]=> + string(6) "string" +} +string(5) "array" +-- Iteration 12 -- +bool(true) +array(1) { + [0]=> + string(11) "some string" +} +string(5) "array" +-- Iteration 13 -- +bool(true) +array(1) { + [0]=> + string(6) "string" +} +string(5) "array" +-- Iteration 14 -- +bool(true) +array(1) { + [0]=> + resource(5) of type (stream) +} +string(5) "array" +-- Iteration 15 -- +bool(true) +array(1) { + [0]=> + resource(6) of type (stream) +} +string(5) "array" +-- Iteration 16 -- +bool(true) +array(2) { + ["x"]=> + int(10) + ["y"]=> + int(20) +} +string(5) "array" + +-- Setting type of data to object -- +-- Iteration 1 -- +bool(true) +object(stdClass)#2 (3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +string(6) "object" +-- Iteration 2 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + string(14) "another string" +} +string(6) "object" +-- Iteration 3 -- +bool(true) +object(stdClass)#2 (3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +string(6) "object" +-- Iteration 4 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + int(1) +} +string(6) "object" +-- Iteration 5 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + int(-20) +} +string(6) "object" +-- Iteration 6 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + float(2.54) +} +string(6) "object" +-- Iteration 7 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + float(-2.54) +} +string(6) "object" +-- Iteration 8 -- +bool(true) +object(stdClass)#2 (0) { +} +string(6) "object" +-- Iteration 9 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + bool(false) +} +string(6) "object" +-- Iteration 10 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + string(11) "some string" +} +string(6) "object" +-- Iteration 11 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + string(6) "string" +} +string(6) "object" +-- Iteration 12 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + string(11) "some string" +} +string(6) "object" +-- Iteration 13 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + string(6) "string" +} +string(6) "object" +-- Iteration 14 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + resource(5) of type (stream) +} +string(6) "object" +-- Iteration 15 -- +bool(true) +object(stdClass)#2 (1) { + ["scalar"]=> + resource(6) of type (stream) +} +string(6) "object" +-- Iteration 16 -- +bool(true) +object(point)#1 (2) { + ["x"]=> + int(10) + ["y"]=> + int(20) +} +string(6) "object" + +-- Setting type of data to string -- +-- Iteration 1 -- +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 2 -- +bool(true) +string(14) "another string" +string(6) "string" +-- Iteration 3 -- +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 4 -- +bool(true) +string(1) "1" +string(6) "string" +-- Iteration 5 -- +bool(true) +string(3) "-20" +string(6) "string" +-- Iteration 6 -- +bool(true) +string(4) "2.54" +string(6) "string" +-- Iteration 7 -- +bool(true) +string(5) "-2.54" +string(6) "string" +-- Iteration 8 -- +bool(true) +string(0) "" +string(6) "string" +-- Iteration 9 -- +bool(true) +string(0) "" +string(6) "string" +-- Iteration 10 -- +bool(true) +string(11) "some string" +string(6) "string" +-- Iteration 11 -- +bool(true) +string(6) "string" +string(6) "string" +-- Iteration 12 -- +bool(true) +string(11) "some string" +string(6) "string" +-- Iteration 13 -- +bool(true) +string(6) "string" +string(6) "string" +-- Iteration 14 -- +bool(true) +string(14) "Resource id #5" +string(6) "string" +-- Iteration 15 -- +bool(true) +string(14) "Resource id #6" +string(6) "string" +-- Iteration 16 -- +bool(true) +string(6) "Object" +string(6) "string" +Done +--UEXPECT-- +**** Testing gettype() and settype() functions **** + +*** Testing gettype(): basic operations *** +unicode(5) "array" +unicode(7) "unicode" +unicode(5) "array" +unicode(7) "integer" +unicode(7) "integer" +unicode(6) "double" +unicode(6) "double" +unicode(4) "NULL" +unicode(7) "boolean" +unicode(7) "unicode" +unicode(7) "unicode" +unicode(6) "string" +unicode(6) "string" +unicode(8) "resource" +unicode(8) "resource" +unicode(6) "object" + +*** Testing settype(): basic operations *** + +-- Setting type of data to null -- +-- Iteration 1 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 2 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 3 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 4 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 5 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 6 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 7 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 8 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 9 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 10 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 11 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 12 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 13 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 14 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 15 -- +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 16 -- +bool(true) +NULL +unicode(4) "NULL" + +-- Setting type of data to integer -- +-- Iteration 1 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 2 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 3 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 4 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 5 -- +bool(true) +int(-20) +unicode(7) "integer" +-- Iteration 6 -- +bool(true) +int(2) +unicode(7) "integer" +-- Iteration 7 -- +bool(true) +int(-2) +unicode(7) "integer" +-- Iteration 8 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 9 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 10 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 11 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 12 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 13 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 14 -- +bool(true) +int(5) +unicode(7) "integer" +-- Iteration 15 -- +bool(true) +int(6) +unicode(7) "integer" +-- Iteration 16 -- +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" + +-- Setting type of data to int -- +-- Iteration 1 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 2 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 3 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 4 -- +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 5 -- +bool(true) +int(-20) +unicode(7) "integer" +-- Iteration 6 -- +bool(true) +int(2) +unicode(7) "integer" +-- Iteration 7 -- +bool(true) +int(-2) +unicode(7) "integer" +-- Iteration 8 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 9 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 10 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 11 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 12 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 13 -- +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 14 -- +bool(true) +int(5) +unicode(7) "integer" +-- Iteration 15 -- +bool(true) +int(6) +unicode(7) "integer" +-- Iteration 16 -- +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" + +-- Setting type of data to float -- +-- Iteration 1 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 2 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 3 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 4 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 5 -- +bool(true) +float(-20) +unicode(6) "double" +-- Iteration 6 -- +bool(true) +float(2.54) +unicode(6) "double" +-- Iteration 7 -- +bool(true) +float(-2.54) +unicode(6) "double" +-- Iteration 8 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 9 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 10 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 11 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 12 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 13 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 14 -- +bool(true) +float(5) +unicode(6) "double" +-- Iteration 15 -- +bool(true) +float(6) +unicode(6) "double" +-- Iteration 16 -- +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" + +-- Setting type of data to double -- +-- Iteration 1 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 2 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 3 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 4 -- +bool(true) +float(1) +unicode(6) "double" +-- Iteration 5 -- +bool(true) +float(-20) +unicode(6) "double" +-- Iteration 6 -- +bool(true) +float(2.54) +unicode(6) "double" +-- Iteration 7 -- +bool(true) +float(-2.54) +unicode(6) "double" +-- Iteration 8 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 9 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 10 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 11 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 12 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 13 -- +bool(true) +float(0) +unicode(6) "double" +-- Iteration 14 -- +bool(true) +float(5) +unicode(6) "double" +-- Iteration 15 -- +bool(true) +float(6) +unicode(6) "double" +-- Iteration 16 -- +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" + +-- Setting type of data to boolean -- +-- Iteration 1 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 2 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 3 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 4 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 5 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 6 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 7 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 8 -- +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 9 -- +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 10 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 11 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 12 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 13 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 14 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 15 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 16 -- +bool(true) +bool(true) +unicode(7) "boolean" + +-- Setting type of data to bool -- +-- Iteration 1 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 2 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 3 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 4 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 5 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 6 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 7 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 8 -- +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 9 -- +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 10 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 11 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 12 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 13 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 14 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 15 -- +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 16 -- +bool(true) +bool(true) +unicode(7) "boolean" + +-- Setting type of data to resource -- +-- Iteration 1 -- +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +unicode(5) "array" +-- Iteration 2 -- +2: settype(): Cannot convert to resource type +bool(false) +unicode(14) "another string" +unicode(7) "unicode" +-- Iteration 3 -- +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +unicode(5) "array" +-- Iteration 4 -- +2: settype(): Cannot convert to resource type +bool(false) +int(1) +unicode(7) "integer" +-- Iteration 5 -- +2: settype(): Cannot convert to resource type +bool(false) +int(-20) +unicode(7) "integer" +-- Iteration 6 -- +2: settype(): Cannot convert to resource type +bool(false) +float(2.54) +unicode(6) "double" +-- Iteration 7 -- +2: settype(): Cannot convert to resource type +bool(false) +float(-2.54) +unicode(6) "double" +-- Iteration 8 -- +2: settype(): Cannot convert to resource type +bool(false) +NULL +unicode(4) "NULL" +-- Iteration 9 -- +2: settype(): Cannot convert to resource type +bool(false) +bool(false) +unicode(7) "boolean" +-- Iteration 10 -- +2: settype(): Cannot convert to resource type +bool(false) +unicode(11) "some string" +unicode(7) "unicode" +-- Iteration 11 -- +2: settype(): Cannot convert to resource type +bool(false) +unicode(6) "string" +unicode(7) "unicode" +-- Iteration 12 -- +2: settype(): Cannot convert to resource type +bool(false) +string(11) "some string" +unicode(6) "string" +-- Iteration 13 -- +2: settype(): Cannot convert to resource type +bool(false) +string(6) "string" +unicode(6) "string" +-- Iteration 14 -- +2: settype(): Cannot convert to resource type +bool(false) +resource(5) of type (stream) +unicode(8) "resource" +-- Iteration 15 -- +2: settype(): Cannot convert to resource type +bool(false) +resource(6) of type (stream) +unicode(8) "resource" +-- Iteration 16 -- +2: settype(): Cannot convert to resource type +bool(false) +object(point)#1 (2) { + [u"x"]=> + int(10) + [u"y"]=> + int(20) +} +unicode(6) "object" + +-- Setting type of data to array -- +-- Iteration 1 -- +bool(true) +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +unicode(5) "array" +-- Iteration 2 -- +bool(true) +array(1) { + [0]=> + unicode(14) "another string" +} +unicode(5) "array" +-- Iteration 3 -- +bool(true) +array(3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +unicode(5) "array" +-- Iteration 4 -- +bool(true) +array(1) { + [0]=> + int(1) +} +unicode(5) "array" +-- Iteration 5 -- +bool(true) +array(1) { + [0]=> + int(-20) +} +unicode(5) "array" +-- Iteration 6 -- +bool(true) +array(1) { + [0]=> + float(2.54) +} +unicode(5) "array" +-- Iteration 7 -- +bool(true) +array(1) { + [0]=> + float(-2.54) +} +unicode(5) "array" +-- Iteration 8 -- +bool(true) +array(0) { +} +unicode(5) "array" +-- Iteration 9 -- +bool(true) +array(1) { + [0]=> + bool(false) +} +unicode(5) "array" +-- Iteration 10 -- +bool(true) +array(1) { + [0]=> + unicode(11) "some string" +} +unicode(5) "array" +-- Iteration 11 -- +bool(true) +array(1) { + [0]=> + unicode(6) "string" +} +unicode(5) "array" +-- Iteration 12 -- +bool(true) +array(1) { + [0]=> + string(11) "some string" +} +unicode(5) "array" +-- Iteration 13 -- +bool(true) +array(1) { + [0]=> + string(6) "string" +} +unicode(5) "array" +-- Iteration 14 -- +bool(true) +array(1) { + [0]=> + resource(5) of type (stream) +} +unicode(5) "array" +-- Iteration 15 -- +bool(true) +array(1) { + [0]=> + resource(6) of type (stream) +} +unicode(5) "array" +-- Iteration 16 -- +bool(true) +array(2) { + [u"x"]=> + int(10) + [u"y"]=> + int(20) +} +unicode(5) "array" + +-- Setting type of data to object -- +-- Iteration 1 -- +bool(true) +object(stdClass)#2 (3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +unicode(6) "object" +-- Iteration 2 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + unicode(14) "another string" +} +unicode(6) "object" +-- Iteration 3 -- +bool(true) +object(stdClass)#2 (3) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(4) +} +unicode(6) "object" +-- Iteration 4 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + int(1) +} +unicode(6) "object" +-- Iteration 5 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + int(-20) +} +unicode(6) "object" +-- Iteration 6 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + float(2.54) +} +unicode(6) "object" +-- Iteration 7 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + float(-2.54) +} +unicode(6) "object" +-- Iteration 8 -- +bool(true) +object(stdClass)#2 (0) { +} +unicode(6) "object" +-- Iteration 9 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + bool(false) +} +unicode(6) "object" +-- Iteration 10 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + unicode(11) "some string" +} +unicode(6) "object" +-- Iteration 11 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + unicode(6) "string" +} +unicode(6) "object" +-- Iteration 12 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + string(11) "some string" +} +unicode(6) "object" +-- Iteration 13 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + string(6) "string" +} +unicode(6) "object" +-- Iteration 14 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + resource(5) of type (stream) +} +unicode(6) "object" +-- Iteration 15 -- +bool(true) +object(stdClass)#2 (1) { + [u"scalar"]=> + resource(6) of type (stream) +} +unicode(6) "object" +-- Iteration 16 -- +bool(true) +object(point)#1 (2) { + [u"x"]=> + int(10) + [u"y"]=> + int(20) +} +unicode(6) "object" + +-- Setting type of data to string -- +-- Iteration 1 -- +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 2 -- +bool(true) +unicode(14) "another string" +unicode(7) "unicode" +-- Iteration 3 -- +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 4 -- +bool(true) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 5 -- +bool(true) +unicode(3) "-20" +unicode(7) "unicode" +-- Iteration 6 -- +bool(true) +unicode(4) "2.54" +unicode(7) "unicode" +-- Iteration 7 -- +bool(true) +unicode(5) "-2.54" +unicode(7) "unicode" +-- Iteration 8 -- +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 9 -- +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 10 -- +bool(true) +unicode(11) "some string" +unicode(7) "unicode" +-- Iteration 11 -- +bool(true) +unicode(6) "string" +unicode(7) "unicode" +-- Iteration 12 -- +bool(true) +unicode(11) "some string" +unicode(7) "unicode" +-- Iteration 13 -- +bool(true) +unicode(6) "string" +unicode(7) "unicode" +-- Iteration 14 -- +bool(true) +unicode(14) "Resource id #5" +unicode(7) "unicode" +-- Iteration 15 -- +bool(true) +unicode(14) "Resource id #6" +unicode(7) "unicode" +-- Iteration 16 -- +bool(true) +unicode(6) "Object" +unicode(7) "unicode" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt new file mode 100644 index 0000000000..54e8b4b7c2 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test gettype() & settype() functions : error conditions +--FILE-- + +--EXPECTF-- +**** Testing gettype() and settype() functions **** + +*** Testing gettype(): error conditions *** + +Warning: Wrong parameter count for gettype() in %s on line %d +NULL + +Warning: Wrong parameter count for gettype() in %s on line %d +NULL + +*** Testing settype(): error conditions *** + +Warning: Wrong parameter count for settype() in %s on line %d +NULL + +Warning: Wrong parameter count for settype() in %s on line %d +NULL + +Warning: settype(): Invalid type in %s on line %d +bool(false) +Done +--UEXPECTF-- +**** Testing gettype() and settype() functions **** + +*** Testing gettype(): error conditions *** + +Warning: Wrong parameter count for gettype() in %s on line %d +NULL + +Warning: Wrong parameter count for gettype() in %s on line %d +NULL + +*** Testing settype(): error conditions *** + +Warning: Wrong parameter count for settype() in %s on line %d +NULL + +Warning: Wrong parameter count for settype() in %s on line %d +NULL + +Warning: settype(): Invalid type in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt new file mode 100644 index 0000000000..35cd7a106a --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt @@ -0,0 +1,1114 @@ +--TEST-- +Test gettype() & settype() functions : usage variatoins +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +/* test conversion to null type */ +$type = "null"; + +echo "\n*** Testing gettype() & settype() functions : usage variations ***\n"; +echo "\n-- Setting type of data to $type --\n"; +$loop_count = 1; +foreach ($var_values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to null + var_dump( settype($var, $type) ); + + // dump the converted data + var_dump( $var ); + + // check the new type after conversion + var_dump( gettype($var) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to null -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +NULL +string(4) "NULL" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +NULL +string(4) "NULL" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +NULL +string(4) "NULL" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +NULL +string(4) "NULL" +-- Iteration 5 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 6 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 7 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 8 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 9 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 10 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 11 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 12 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 13 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 14 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 15 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 16 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 17 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 18 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 19 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 20 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 21 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 22 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 23 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 24 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 25 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 26 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 27 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 28 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 29 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 30 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 31 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 32 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 33 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 34 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 35 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 36 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 37 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 38 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 39 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 40 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 41 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 42 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 43 -- +string(5) "array" +bool(true) +NULL +string(4) "NULL" +-- Iteration 44 -- +string(5) "array" +bool(true) +NULL +string(4) "NULL" +-- Iteration 45 -- +string(5) "array" +bool(true) +NULL +string(4) "NULL" +-- Iteration 46 -- +string(5) "array" +bool(true) +NULL +string(4) "NULL" +-- Iteration 47 -- +string(5) "array" +bool(true) +NULL +string(4) "NULL" +-- Iteration 48 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 49 -- +string(7) "integer" +bool(true) +NULL +string(4) "NULL" +-- Iteration 50 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 51 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 52 -- +string(7) "integer" +bool(true) +NULL +string(4) "NULL" +-- Iteration 53 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 54 -- +string(7) "integer" +bool(true) +NULL +string(4) "NULL" +-- Iteration 55 -- +string(7) "integer" +bool(true) +NULL +string(4) "NULL" +-- Iteration 56 -- +string(7) "integer" +bool(true) +NULL +string(4) "NULL" +-- Iteration 57 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 58 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 59 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 60 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 61 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 62 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 63 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 64 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 65 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 66 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 67 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 68 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 69 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 70 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 71 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 72 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 73 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 74 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 75 -- +string(6) "double" +bool(true) +NULL +string(4) "NULL" +-- Iteration 76 -- +string(6) "object" +bool(true) +NULL +string(4) "NULL" +-- Iteration 77 -- +string(6) "object" +bool(true) +NULL +string(4) "NULL" +-- Iteration 78 -- +string(6) "object" +bool(true) +NULL +string(4) "NULL" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +NULL +string(4) "NULL" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +NULL +string(4) "NULL" +-- Iteration 81 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 82 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 83 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 84 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 85 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 86 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 87 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 88 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 89 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 90 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +-- Iteration 91 -- +string(6) "string" +bool(true) +NULL +string(4) "NULL" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to null -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 76 -- +unicode(6) "object" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 77 -- +unicode(6) "object" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 78 -- +unicode(6) "object" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +NULL +unicode(4) "NULL" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt new file mode 100644 index 0000000000..d60c626bf2 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt @@ -0,0 +1,2045 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +// test conversion to these types +$types = array( + "integer", + "int" +); + +echo "\n*** Testing settype() & gettype() : usage variations ***\n"; +foreach ($types as $type) { + echo "\n-- Setting type of data to $type --\n"; + $inner_loop_count = 1; + foreach ($var_values as $var) { + echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to new type + var_dump( settype($var, $type) ); + + // dump the converted $var + var_dump( $var ); + + // get the new type of the $var + var_dump( gettype($var) ); + } +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to integer -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +int(0) +string(7) "integer" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +int(1) +string(7) "integer" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +int(1) +string(7) "integer" +-- Iteration 5 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 6 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 7 -- +string(6) "string" +bool(true) +int(3) +string(7) "integer" +-- Iteration 8 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 9 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 10 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 11 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 12 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 13 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 14 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 15 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 16 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 17 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 18 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 19 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 20 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 21 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 22 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 23 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 24 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 25 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 26 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 27 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 28 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 29 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 30 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 31 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 32 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 33 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 34 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 35 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 36 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 37 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 38 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 39 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 40 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 41 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 42 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 43 -- +string(5) "array" +bool(true) +int(0) +string(7) "integer" +-- Iteration 44 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 45 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 46 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 47 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 48 -- +string(6) "double" +bool(true) +int(-2147483648) +string(7) "integer" +-- Iteration 49 -- +string(7) "integer" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 50 -- +string(6) "double" +bool(true) +int(-2147483647) +string(7) "integer" +-- Iteration 51 -- +string(6) "double" +bool(true) +int(-508130303) +string(7) "integer" +-- Iteration 52 -- +string(7) "integer" +bool(true) +int(85) +string(7) "integer" +-- Iteration 53 -- +string(6) "double" +bool(true) +int(1952002105) +string(7) "integer" +-- Iteration 54 -- +string(7) "integer" +bool(true) +int(-21903) +string(7) "integer" +-- Iteration 55 -- +string(7) "integer" +bool(true) +int(365) +string(7) "integer" +-- Iteration 56 -- +string(7) "integer" +bool(true) +int(-365) +string(7) "integer" +-- Iteration 57 -- +string(6) "double" +bool(true) +int(343000682) +string(7) "integer" +-- Iteration 58 -- +string(6) "double" +bool(true) +int(100000) +string(7) "integer" +-- Iteration 59 -- +string(6) "double" +bool(true) +int(-100000) +string(7) "integer" +-- Iteration 60 -- +string(6) "double" +bool(true) +int(100000) +string(7) "integer" +-- Iteration 61 -- +string(6) "double" +bool(true) +int(-100000) +string(7) "integer" +-- Iteration 62 -- +string(6) "double" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 63 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 64 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 65 -- +string(6) "double" +bool(true) +int(500000) +string(7) "integer" +-- Iteration 66 -- +string(6) "double" +bool(true) +int(-500000) +string(7) "integer" +-- Iteration 67 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 68 -- +string(6) "double" +bool(true) +int(500000) +string(7) "integer" +-- Iteration 69 -- +string(6) "double" +bool(true) +int(-500000) +string(7) "integer" +-- Iteration 70 -- +string(6) "double" +bool(true) +int(512000) +string(7) "integer" +-- Iteration 71 -- +string(6) "double" +bool(true) +int(-512000) +string(7) "integer" +-- Iteration 72 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 73 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 74 -- +string(6) "double" +bool(true) +int(512000) +string(7) "integer" +-- Iteration 75 -- +string(6) "double" +bool(true) +int(-512000) +string(7) "integer" +-- Iteration 76 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 77 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 78 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 81 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 82 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 83 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 84 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 85 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 86 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 87 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 88 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 89 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 90 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 91 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" + +-- Setting type of data to int -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +int(0) +string(7) "integer" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +int(1) +string(7) "integer" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +int(1) +string(7) "integer" +-- Iteration 5 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 6 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 7 -- +string(6) "string" +bool(true) +int(3) +string(7) "integer" +-- Iteration 8 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 9 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 10 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 11 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 12 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 13 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 14 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 15 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 16 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 17 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 18 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 19 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 20 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 21 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 22 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 23 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 24 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 25 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 26 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 27 -- +string(6) "string" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 28 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 29 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 30 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 31 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 32 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 33 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 34 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 35 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 36 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 37 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 38 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 39 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 40 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 41 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 42 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 43 -- +string(5) "array" +bool(true) +int(0) +string(7) "integer" +-- Iteration 44 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 45 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 46 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 47 -- +string(5) "array" +bool(true) +int(1) +string(7) "integer" +-- Iteration 48 -- +string(6) "double" +bool(true) +int(-2147483648) +string(7) "integer" +-- Iteration 49 -- +string(7) "integer" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 50 -- +string(6) "double" +bool(true) +int(-2147483647) +string(7) "integer" +-- Iteration 51 -- +string(6) "double" +bool(true) +int(-508130303) +string(7) "integer" +-- Iteration 52 -- +string(7) "integer" +bool(true) +int(85) +string(7) "integer" +-- Iteration 53 -- +string(6) "double" +bool(true) +int(1952002105) +string(7) "integer" +-- Iteration 54 -- +string(7) "integer" +bool(true) +int(-21903) +string(7) "integer" +-- Iteration 55 -- +string(7) "integer" +bool(true) +int(365) +string(7) "integer" +-- Iteration 56 -- +string(7) "integer" +bool(true) +int(-365) +string(7) "integer" +-- Iteration 57 -- +string(6) "double" +bool(true) +int(343000682) +string(7) "integer" +-- Iteration 58 -- +string(6) "double" +bool(true) +int(100000) +string(7) "integer" +-- Iteration 59 -- +string(6) "double" +bool(true) +int(-100000) +string(7) "integer" +-- Iteration 60 -- +string(6) "double" +bool(true) +int(100000) +string(7) "integer" +-- Iteration 61 -- +string(6) "double" +bool(true) +int(-100000) +string(7) "integer" +-- Iteration 62 -- +string(6) "double" +bool(true) +int(-1) +string(7) "integer" +-- Iteration 63 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 64 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 65 -- +string(6) "double" +bool(true) +int(500000) +string(7) "integer" +-- Iteration 66 -- +string(6) "double" +bool(true) +int(-500000) +string(7) "integer" +-- Iteration 67 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 68 -- +string(6) "double" +bool(true) +int(500000) +string(7) "integer" +-- Iteration 69 -- +string(6) "double" +bool(true) +int(-500000) +string(7) "integer" +-- Iteration 70 -- +string(6) "double" +bool(true) +int(512000) +string(7) "integer" +-- Iteration 71 -- +string(6) "double" +bool(true) +int(-512000) +string(7) "integer" +-- Iteration 72 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 73 -- +string(6) "double" +bool(true) +int(0) +string(7) "integer" +-- Iteration 74 -- +string(6) "double" +bool(true) +int(512000) +string(7) "integer" +-- Iteration 75 -- +string(6) "double" +bool(true) +int(-512000) +string(7) "integer" +-- Iteration 76 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 77 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 78 -- +string(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +string(7) "integer" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +int(0) +string(7) "integer" +-- Iteration 81 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 82 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 83 -- +string(6) "string" +bool(true) +int(123) +string(7) "integer" +-- Iteration 84 -- +string(6) "string" +bool(true) +int(-123) +string(7) "integer" +-- Iteration 85 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 86 -- +string(6) "string" +bool(true) +int(0) +string(7) "integer" +-- Iteration 87 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 88 -- +string(6) "string" +bool(true) +int(2147483647) +string(7) "integer" +-- Iteration 89 -- +string(6) "string" +bool(true) +int(1) +string(7) "integer" +-- Iteration 90 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +-- Iteration 91 -- +string(6) "string" +bool(true) +int(10) +string(7) "integer" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to integer -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +int(3) +unicode(7) "integer" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +int(-2147483648) +unicode(7) "integer" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +int(-2147483647) +unicode(7) "integer" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +int(-508130303) +unicode(7) "integer" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +int(85) +unicode(7) "integer" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +int(1952002105) +unicode(7) "integer" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +int(-21903) +unicode(7) "integer" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +int(365) +unicode(7) "integer" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +int(-365) +unicode(7) "integer" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +int(343000682) +unicode(7) "integer" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +int(100000) +unicode(7) "integer" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +int(-100000) +unicode(7) "integer" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +int(100000) +unicode(7) "integer" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +int(-100000) +unicode(7) "integer" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +int(500000) +unicode(7) "integer" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +int(-500000) +unicode(7) "integer" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +int(500000) +unicode(7) "integer" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +int(-500000) +unicode(7) "integer" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +int(512000) +unicode(7) "integer" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +int(-512000) +unicode(7) "integer" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +int(512000) +unicode(7) "integer" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +int(-512000) +unicode(7) "integer" +-- Iteration 76 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 77 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 78 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" + +-- Setting type of data to int -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +int(3) +unicode(7) "integer" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +int(-2147483648) +unicode(7) "integer" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +int(-2147483647) +unicode(7) "integer" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +int(-508130303) +unicode(7) "integer" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +int(85) +unicode(7) "integer" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +int(1952002105) +unicode(7) "integer" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +int(-21903) +unicode(7) "integer" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +int(365) +unicode(7) "integer" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +int(-365) +unicode(7) "integer" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +int(343000682) +unicode(7) "integer" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +int(100000) +unicode(7) "integer" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +int(-100000) +unicode(7) "integer" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +int(100000) +unicode(7) "integer" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +int(-100000) +unicode(7) "integer" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +int(-1) +unicode(7) "integer" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +int(500000) +unicode(7) "integer" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +int(-500000) +unicode(7) "integer" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +int(500000) +unicode(7) "integer" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +int(-500000) +unicode(7) "integer" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +int(512000) +unicode(7) "integer" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +int(-512000) +unicode(7) "integer" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +int(512000) +unicode(7) "integer" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +int(-512000) +unicode(7) "integer" +-- Iteration 76 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 77 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 78 -- +unicode(6) "object" +8: Object of class point could not be converted to int +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +int(123) +unicode(7) "integer" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +int(-123) +unicode(7) "integer" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +int(0) +unicode(7) "integer" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +int(2147483647) +unicode(7) "integer" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +int(1) +unicode(7) "integer" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +int(10) +unicode(7) "integer" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt new file mode 100644 index 0000000000..a39e5ed494 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt @@ -0,0 +1,2045 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +// test conversion to these types +$types = array( + "float", + "double" +); + +echo "\n*** Testing settype() & gettype() : usage variations ***\n"; +foreach ($types as $type) { + echo "\n-- Setting type of data to $type --\n"; + $inner_loop_count = 1; + foreach ($var_values as $var) { + echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to new type + var_dump( settype($var, $type) ); + + // dump the converted $var + var_dump( $var ); + + // get the new type of the $var + var_dump( gettype($var) ); + } +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to float -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +float(0) +string(6) "double" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +float(1) +string(6) "double" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +float(1) +string(6) "double" +-- Iteration 5 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 6 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 7 -- +string(6) "string" +bool(true) +float(3) +string(6) "double" +-- Iteration 8 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 9 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 10 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 11 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 12 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 13 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 14 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 15 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 16 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 17 -- +string(6) "string" +bool(true) +float(-1) +string(6) "double" +-- Iteration 18 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 19 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 20 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 21 -- +string(6) "string" +bool(true) +float(-0.01) +string(6) "double" +-- Iteration 22 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 23 -- +string(6) "string" +bool(true) +float(-1) +string(6) "double" +-- Iteration 24 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 25 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 26 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 27 -- +string(6) "string" +bool(true) +float(-0.01) +string(6) "double" +-- Iteration 28 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 29 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 30 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 31 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 32 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 33 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 34 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 35 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 36 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 37 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 38 -- +string(6) "string" +bool(true) +float(-0) +string(6) "double" +-- Iteration 39 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 40 -- +string(6) "string" +bool(true) +float(-0) +string(6) "double" +-- Iteration 41 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 42 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 43 -- +string(5) "array" +bool(true) +float(0) +string(6) "double" +-- Iteration 44 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 45 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 46 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 47 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 48 -- +string(6) "double" +bool(true) +float(-2147483648) +string(6) "double" +-- Iteration 49 -- +string(7) "integer" +bool(true) +float(2147483647) +string(6) "double" +-- Iteration 50 -- +string(6) "double" +bool(true) +float(2147483649) +string(6) "double" +-- Iteration 51 -- +string(6) "double" +bool(true) +float(1232147483649) +string(6) "double" +-- Iteration 52 -- +string(7) "integer" +bool(true) +float(85) +string(6) "double" +-- Iteration 53 -- +string(6) "double" +bool(true) +float(1058513956921) +string(6) "double" +-- Iteration 54 -- +string(7) "integer" +bool(true) +float(-21903) +string(6) "double" +-- Iteration 55 -- +string(7) "integer" +bool(true) +float(365) +string(6) "double" +-- Iteration 56 -- +string(7) "integer" +bool(true) +float(-365) +string(6) "double" +-- Iteration 57 -- +string(6) "double" +bool(true) +float(80561044571754) +string(6) "double" +-- Iteration 58 -- +string(6) "double" +bool(true) +float(100000) +string(6) "double" +-- Iteration 59 -- +string(6) "double" +bool(true) +float(-100000) +string(6) "double" +-- Iteration 60 -- +string(6) "double" +bool(true) +float(100000) +string(6) "double" +-- Iteration 61 -- +string(6) "double" +bool(true) +float(-100000) +string(6) "double" +-- Iteration 62 -- +string(6) "double" +bool(true) +float(-1.5) +string(6) "double" +-- Iteration 63 -- +string(6) "double" +bool(true) +float(0.5) +string(6) "double" +-- Iteration 64 -- +string(6) "double" +bool(true) +float(-0.5) +string(6) "double" +-- Iteration 65 -- +string(6) "double" +bool(true) +float(500000) +string(6) "double" +-- Iteration 66 -- +string(6) "double" +bool(true) +float(-500000) +string(6) "double" +-- Iteration 67 -- +string(6) "double" +bool(true) +float(-5.0E-7) +string(6) "double" +-- Iteration 68 -- +string(6) "double" +bool(true) +float(500000) +string(6) "double" +-- Iteration 69 -- +string(6) "double" +bool(true) +float(-500000) +string(6) "double" +-- Iteration 70 -- +string(6) "double" +bool(true) +float(512000) +string(6) "double" +-- Iteration 71 -- +string(6) "double" +bool(true) +float(-512000) +string(6) "double" +-- Iteration 72 -- +string(6) "double" +bool(true) +float(5.12E-7) +string(6) "double" +-- Iteration 73 -- +string(6) "double" +bool(true) +float(5.12E-7) +string(6) "double" +-- Iteration 74 -- +string(6) "double" +bool(true) +float(512000) +string(6) "double" +-- Iteration 75 -- +string(6) "double" +bool(true) +float(-512000) +string(6) "double" +-- Iteration 76 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 77 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 78 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 81 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 82 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 83 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 84 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 85 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 86 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 87 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 88 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 89 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 90 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 91 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" + +-- Setting type of data to double -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +float(0) +string(6) "double" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +float(1) +string(6) "double" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +float(1) +string(6) "double" +-- Iteration 5 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 6 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 7 -- +string(6) "string" +bool(true) +float(3) +string(6) "double" +-- Iteration 8 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 9 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 10 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 11 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 12 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 13 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 14 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 15 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 16 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 17 -- +string(6) "string" +bool(true) +float(-1) +string(6) "double" +-- Iteration 18 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 19 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 20 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 21 -- +string(6) "string" +bool(true) +float(-0.01) +string(6) "double" +-- Iteration 22 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 23 -- +string(6) "string" +bool(true) +float(-1) +string(6) "double" +-- Iteration 24 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 25 -- +string(6) "string" +bool(true) +float(1) +string(6) "double" +-- Iteration 26 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 27 -- +string(6) "string" +bool(true) +float(-0.01) +string(6) "double" +-- Iteration 28 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 29 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 30 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 31 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 32 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 33 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 34 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 35 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 36 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 37 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 38 -- +string(6) "string" +bool(true) +float(-0) +string(6) "double" +-- Iteration 39 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 40 -- +string(6) "string" +bool(true) +float(-0) +string(6) "double" +-- Iteration 41 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 42 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 43 -- +string(5) "array" +bool(true) +float(0) +string(6) "double" +-- Iteration 44 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 45 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 46 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 47 -- +string(5) "array" +bool(true) +float(1) +string(6) "double" +-- Iteration 48 -- +string(6) "double" +bool(true) +float(-2147483648) +string(6) "double" +-- Iteration 49 -- +string(7) "integer" +bool(true) +float(2147483647) +string(6) "double" +-- Iteration 50 -- +string(6) "double" +bool(true) +float(2147483649) +string(6) "double" +-- Iteration 51 -- +string(6) "double" +bool(true) +float(1232147483649) +string(6) "double" +-- Iteration 52 -- +string(7) "integer" +bool(true) +float(85) +string(6) "double" +-- Iteration 53 -- +string(6) "double" +bool(true) +float(1058513956921) +string(6) "double" +-- Iteration 54 -- +string(7) "integer" +bool(true) +float(-21903) +string(6) "double" +-- Iteration 55 -- +string(7) "integer" +bool(true) +float(365) +string(6) "double" +-- Iteration 56 -- +string(7) "integer" +bool(true) +float(-365) +string(6) "double" +-- Iteration 57 -- +string(6) "double" +bool(true) +float(80561044571754) +string(6) "double" +-- Iteration 58 -- +string(6) "double" +bool(true) +float(100000) +string(6) "double" +-- Iteration 59 -- +string(6) "double" +bool(true) +float(-100000) +string(6) "double" +-- Iteration 60 -- +string(6) "double" +bool(true) +float(100000) +string(6) "double" +-- Iteration 61 -- +string(6) "double" +bool(true) +float(-100000) +string(6) "double" +-- Iteration 62 -- +string(6) "double" +bool(true) +float(-1.5) +string(6) "double" +-- Iteration 63 -- +string(6) "double" +bool(true) +float(0.5) +string(6) "double" +-- Iteration 64 -- +string(6) "double" +bool(true) +float(-0.5) +string(6) "double" +-- Iteration 65 -- +string(6) "double" +bool(true) +float(500000) +string(6) "double" +-- Iteration 66 -- +string(6) "double" +bool(true) +float(-500000) +string(6) "double" +-- Iteration 67 -- +string(6) "double" +bool(true) +float(-5.0E-7) +string(6) "double" +-- Iteration 68 -- +string(6) "double" +bool(true) +float(500000) +string(6) "double" +-- Iteration 69 -- +string(6) "double" +bool(true) +float(-500000) +string(6) "double" +-- Iteration 70 -- +string(6) "double" +bool(true) +float(512000) +string(6) "double" +-- Iteration 71 -- +string(6) "double" +bool(true) +float(-512000) +string(6) "double" +-- Iteration 72 -- +string(6) "double" +bool(true) +float(5.12E-7) +string(6) "double" +-- Iteration 73 -- +string(6) "double" +bool(true) +float(5.12E-7) +string(6) "double" +-- Iteration 74 -- +string(6) "double" +bool(true) +float(512000) +string(6) "double" +-- Iteration 75 -- +string(6) "double" +bool(true) +float(-512000) +string(6) "double" +-- Iteration 76 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 77 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 78 -- +string(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +string(6) "double" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +float(0) +string(6) "double" +-- Iteration 81 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 82 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 83 -- +string(6) "string" +bool(true) +float(123) +string(6) "double" +-- Iteration 84 -- +string(6) "string" +bool(true) +float(-123) +string(6) "double" +-- Iteration 85 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 86 -- +string(6) "string" +bool(true) +float(0) +string(6) "double" +-- Iteration 87 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 88 -- +string(6) "string" +bool(true) +float(2.9743947493287E+21) +string(6) "double" +-- Iteration 89 -- +string(6) "string" +bool(true) +float(100) +string(6) "double" +-- Iteration 90 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +-- Iteration 91 -- +string(6) "string" +bool(true) +float(10) +string(6) "double" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to float -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +float(3) +unicode(6) "double" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +float(-1) +unicode(6) "double" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +float(-0.01) +unicode(6) "double" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +float(-1) +unicode(6) "double" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +float(-0.01) +unicode(6) "double" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +float(-0) +unicode(6) "double" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +float(-0) +unicode(6) "double" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +float(-2147483648) +unicode(6) "double" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +float(2147483647) +unicode(6) "double" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +float(2147483649) +unicode(6) "double" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +float(1232147483649) +unicode(6) "double" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +float(85) +unicode(6) "double" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +float(1058513956921) +unicode(6) "double" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +float(-21903) +unicode(6) "double" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +float(365) +unicode(6) "double" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +float(-365) +unicode(6) "double" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +float(80561044571754) +unicode(6) "double" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +float(100000) +unicode(6) "double" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +float(-100000) +unicode(6) "double" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +float(100000) +unicode(6) "double" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +float(-100000) +unicode(6) "double" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +float(-1.5) +unicode(6) "double" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +float(0.5) +unicode(6) "double" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +float(-0.5) +unicode(6) "double" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +float(500000) +unicode(6) "double" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +float(-500000) +unicode(6) "double" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +float(-5.0E-7) +unicode(6) "double" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +float(500000) +unicode(6) "double" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +float(-500000) +unicode(6) "double" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +float(512000) +unicode(6) "double" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +float(-512000) +unicode(6) "double" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +float(5.12E-7) +unicode(6) "double" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +float(5.12E-7) +unicode(6) "double" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +float(512000) +unicode(6) "double" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +float(-512000) +unicode(6) "double" +-- Iteration 76 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 77 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 78 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" + +-- Setting type of data to double -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +float(3) +unicode(6) "double" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +float(-1) +unicode(6) "double" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +float(-0.01) +unicode(6) "double" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +float(-1) +unicode(6) "double" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +float(-0.01) +unicode(6) "double" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +float(-0) +unicode(6) "double" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +float(-0) +unicode(6) "double" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +float(1) +unicode(6) "double" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +float(-2147483648) +unicode(6) "double" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +float(2147483647) +unicode(6) "double" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +float(2147483649) +unicode(6) "double" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +float(1232147483649) +unicode(6) "double" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +float(85) +unicode(6) "double" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +float(1058513956921) +unicode(6) "double" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +float(-21903) +unicode(6) "double" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +float(365) +unicode(6) "double" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +float(-365) +unicode(6) "double" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +float(80561044571754) +unicode(6) "double" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +float(100000) +unicode(6) "double" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +float(-100000) +unicode(6) "double" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +float(100000) +unicode(6) "double" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +float(-100000) +unicode(6) "double" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +float(-1.5) +unicode(6) "double" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +float(0.5) +unicode(6) "double" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +float(-0.5) +unicode(6) "double" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +float(500000) +unicode(6) "double" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +float(-500000) +unicode(6) "double" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +float(-5.0E-7) +unicode(6) "double" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +float(500000) +unicode(6) "double" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +float(-500000) +unicode(6) "double" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +float(512000) +unicode(6) "double" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +float(-512000) +unicode(6) "double" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +float(5.12E-7) +unicode(6) "double" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +float(5.12E-7) +unicode(6) "double" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +float(512000) +unicode(6) "double" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +float(-512000) +unicode(6) "double" +-- Iteration 76 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 77 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 78 -- +unicode(6) "object" +8: Object of class point could not be converted to double +bool(true) +float(1) +unicode(6) "double" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +float(123) +unicode(6) "double" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +float(-123) +unicode(6) "double" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +float(0) +unicode(6) "double" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +float(2.9743947493287E+21) +unicode(6) "double" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +float(100) +unicode(6) "double" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +float(10) +unicode(6) "double" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt new file mode 100644 index 0000000000..d005a15572 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt @@ -0,0 +1,2185 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +class class_with_no_member { + // no member(s) +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + "0", + '0', + + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + 0, + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 0.0, + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + new class_with_no_member, + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"0", + b'0', + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +// test conversion to these types +$types = array( + "boolean", + "bool" +); + +echo "\n*** Testing settype() & gettype() : usage variations ***\n"; +foreach ($types as $type) { + echo "\n-- Setting type of data to $type --\n"; + $inner_loop_count = 1; + foreach ($var_values as $var) { + echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to new type + var_dump( settype($var, $type) ); + + // dump the converted $var + var_dump( $var ); + + // get the new type of the $var + var_dump( gettype($var) ); + } +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to boolean -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 5 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 6 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 7 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 8 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 9 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 10 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 11 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 12 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 13 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 14 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 15 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 16 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 17 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 18 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 19 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 20 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 21 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 22 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 23 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 24 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 25 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 26 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 27 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 28 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 29 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 30 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 31 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 32 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 33 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 34 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 35 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 36 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 37 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 38 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 39 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 40 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 41 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 42 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 43 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 44 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 45 -- +string(5) "array" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 46 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 47 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 48 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 49 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 50 -- +string(7) "integer" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 51 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 52 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 53 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 54 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 55 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 56 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 57 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 58 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 59 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 60 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 61 -- +string(6) "double" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 62 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 63 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 64 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 65 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 66 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 67 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 68 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 69 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 70 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 71 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 72 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 73 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 74 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 75 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 76 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 77 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 78 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 79 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 80 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 81 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 82 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 83 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 84 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 85 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 86 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 87 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 88 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 89 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 90 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 91 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 92 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 93 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 94 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 95 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 96 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 97 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 98 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" + +-- Setting type of data to bool -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 5 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 6 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 7 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 8 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 9 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 10 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 11 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 12 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 13 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 14 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 15 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 16 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 17 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 18 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 19 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 20 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 21 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 22 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 23 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 24 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 25 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 26 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 27 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 28 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 29 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 30 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 31 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 32 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 33 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 34 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 35 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 36 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 37 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 38 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 39 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 40 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 41 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 42 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 43 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 44 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 45 -- +string(5) "array" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 46 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 47 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 48 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 49 -- +string(5) "array" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 50 -- +string(7) "integer" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 51 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 52 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 53 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 54 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 55 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 56 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 57 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 58 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 59 -- +string(7) "integer" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 60 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 61 -- +string(6) "double" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 62 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 63 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 64 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 65 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 66 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 67 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 68 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 69 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 70 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 71 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 72 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 73 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 74 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 75 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 76 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 77 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 78 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 79 -- +string(6) "double" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 80 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 81 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 82 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 83 -- +string(6) "object" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 84 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 85 -- +string(4) "NULL" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 86 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 87 -- +string(6) "string" +bool(true) +bool(false) +string(7) "boolean" +-- Iteration 88 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 89 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 90 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 91 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 92 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 93 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 94 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 95 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 96 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 97 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +-- Iteration 98 -- +string(6) "string" +bool(true) +bool(true) +string(7) "boolean" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing settype() & gettype() : usage variations *** + +-- Setting type of data to boolean -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 43 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 44 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 48 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 49 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 50 -- +unicode(7) "integer" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 54 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 56 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 57 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 58 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 59 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 76 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 77 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 78 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 79 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 80 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 81 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 82 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 83 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 84 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 85 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 92 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 93 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 94 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 95 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 96 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 97 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 98 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" + +-- Setting type of data to bool -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 43 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 44 -- +unicode(7) "unicode" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 48 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 49 -- +unicode(5) "array" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 50 -- +unicode(7) "integer" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 54 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 56 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 57 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 58 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 59 -- +unicode(7) "integer" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 76 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 77 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 78 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 79 -- +unicode(6) "double" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 80 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 81 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 82 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 83 -- +unicode(6) "object" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 84 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 85 -- +unicode(4) "NULL" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +bool(false) +unicode(7) "boolean" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 92 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 93 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 94 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 95 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 96 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 97 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +-- Iteration 98 -- +unicode(6) "string" +bool(true) +bool(true) +unicode(7) "boolean" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt new file mode 100644 index 0000000000..7746d5fb88 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt @@ -0,0 +1,1242 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var +); + +/* test conversion to resource type */ +$type = "resource"; + +echo "\n*** Testing gettype() & settype() functions : usage variations ***\n"; +echo "\n-- Setting type of data to $type --\n"; +$loop_count = 1; +foreach ($var_values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to null + var_dump( settype($var, $type) ); + + // dump the converted data + var_dump( $var ); + + // check the new type after conversion + var_dump( gettype($var) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to resource -- +-- Iteration 1 -- +string(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +string(4) "NULL" +-- Iteration 2 -- +string(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(false) +string(7) "boolean" +-- Iteration 3 -- +string(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(true) +string(7) "boolean" +-- Iteration 4 -- +string(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(true) +string(7) "boolean" +-- Iteration 5 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) "ÿ" +string(6) "string" +-- Iteration 6 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) "f" +string(6) "string" +-- Iteration 7 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) " +3" +string(6) "string" +-- Iteration 8 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(0) "" +string(6) "string" +-- Iteration 9 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(0) "" +string(6) "string" +-- Iteration 10 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) " " +string(6) "string" +-- Iteration 11 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) " " +string(6) "string" +-- Iteration 12 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) "10" +string(6) "string" +-- Iteration 13 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) "10" +string(6) "string" +-- Iteration 14 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(8) "10string" +string(6) "string" +-- Iteration 15 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(8) "10string" +string(6) "string" +-- Iteration 16 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) "1" +string(6) "string" +-- Iteration 17 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) "-1" +string(6) "string" +-- Iteration 18 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(3) "1e2" +string(6) "string" +-- Iteration 19 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) " 1" +string(6) "string" +-- Iteration 20 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(22) "2974394749328742328432" +string(6) "string" +-- Iteration 21 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "-1e-2" +string(6) "string" +-- Iteration 22 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(1) "1" +string(6) "string" +-- Iteration 23 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) "-1" +string(6) "string" +-- Iteration 24 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(3) "1e2" +string(6) "string" +-- Iteration 25 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(2) " 1" +string(6) "string" +-- Iteration 26 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(22) "2974394749328742328432" +string(6) "string" +-- Iteration 27 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "-1e-2" +string(6) "string" +-- Iteration 28 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(4) "0xff" +string(6) "string" +-- Iteration 29 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(4) "0x55" +string(6) "string" +-- Iteration 30 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "0XA55" +string(6) "string" +-- Iteration 31 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "0X123" +string(6) "string" +-- Iteration 32 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(4) "0123" +string(6) "string" +-- Iteration 33 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(4) "0123" +string(6) "string" +-- Iteration 34 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "-0123" +string(6) "string" +-- Iteration 35 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "+0123" +string(6) "string" +-- Iteration 36 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "-0123" +string(6) "string" +-- Iteration 37 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(5) "+0123" +string(6) "string" +-- Iteration 38 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(8) "-0x80001" +string(6) "string" +-- Iteration 39 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(8) "+0x80001" +string(6) "string" +-- Iteration 40 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(10) "-0x80001.5" +string(6) "string" +-- Iteration 41 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(9) "0x80001.5" +string(6) "string" +-- Iteration 42 -- +string(6) "string" +2: settype(): Cannot convert to resource type +bool(false) +string(12) "@$%#$%^$%^&^" +string(6) "string" +-- Iteration 43 -- +string(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(0) { +} +string(5) "array" +-- Iteration 44 -- +string(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(1) { + [0]=> + NULL +} +string(5) "array" +-- Iteration 45 -- +string(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +string(5) "array" +-- Iteration 46 -- +string(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + ["four"]=> + int(4) +} +string(5) "array" +-- Iteration 47 -- +string(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +string(5) "array" +-- Iteration 48 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-2147483648) +string(6) "double" +-- Iteration 49 -- +string(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(2147483647) +string(7) "integer" +-- Iteration 50 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(2147483649) +string(6) "double" +-- Iteration 51 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(1232147483649) +string(6) "double" +-- Iteration 52 -- +string(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(85) +string(7) "integer" +-- Iteration 53 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(1058513956921) +string(6) "double" +-- Iteration 54 -- +string(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(-21903) +string(7) "integer" +-- Iteration 55 -- +string(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(365) +string(7) "integer" +-- Iteration 56 -- +string(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(-365) +string(7) "integer" +-- Iteration 57 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(80561044571754) +string(6) "double" +-- Iteration 58 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(100000) +string(6) "double" +-- Iteration 59 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-100000) +string(6) "double" +-- Iteration 60 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(100000) +string(6) "double" +-- Iteration 61 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-100000) +string(6) "double" +-- Iteration 62 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-1.5) +string(6) "double" +-- Iteration 63 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(0.5) +string(6) "double" +-- Iteration 64 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-0.5) +string(6) "double" +-- Iteration 65 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(500000) +string(6) "double" +-- Iteration 66 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-500000) +string(6) "double" +-- Iteration 67 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-5.0E-7) +string(6) "double" +-- Iteration 68 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(500000) +string(6) "double" +-- Iteration 69 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-500000) +string(6) "double" +-- Iteration 70 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(512000) +string(6) "double" +-- Iteration 71 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-512000) +string(6) "double" +-- Iteration 72 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(5.12E-7) +string(6) "double" +-- Iteration 73 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(5.12E-7) +string(6) "double" +-- Iteration 74 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(512000) +string(6) "double" +-- Iteration 75 -- +string(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-512000) +string(6) "double" +-- Iteration 76 -- +string(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#1 (2) { + ["x"]=> + NULL + ["y"]=> + NULL +} +string(6) "object" +-- Iteration 77 -- +string(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#2 (2) { + ["x"]=> + float(2.5) + ["y"]=> + float(40.5) +} +string(6) "object" +-- Iteration 78 -- +string(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#3 (2) { + ["x"]=> + int(0) + ["y"]=> + int(0) +} +string(6) "object" +-- Iteration 79 -- +string(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +string(4) "NULL" +-- Iteration 80 -- +string(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +string(4) "NULL" +Done + +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to resource -- +-- Iteration 1 -- +unicode(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +unicode(4) "NULL" +-- Iteration 2 -- +unicode(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(false) +unicode(7) "boolean" +-- Iteration 3 -- +unicode(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(true) +unicode(7) "boolean" +-- Iteration 4 -- +unicode(7) "boolean" +2: settype(): Cannot convert to resource type +bool(false) +bool(true) +unicode(7) "boolean" +-- Iteration 5 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) "ÿ" +unicode(7) "unicode" +-- Iteration 6 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) "f" +unicode(7) "unicode" +-- Iteration 7 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) " +3" +unicode(7) "unicode" +-- Iteration 8 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 9 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 10 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) " " +unicode(7) "unicode" +-- Iteration 11 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) " " +unicode(7) "unicode" +-- Iteration 12 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) "10" +unicode(7) "unicode" +-- Iteration 13 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) "10" +unicode(7) "unicode" +-- Iteration 14 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 15 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 16 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 17 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) "-1" +unicode(7) "unicode" +-- Iteration 18 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 19 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) " 1" +unicode(7) "unicode" +-- Iteration 20 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(22) "2974394749328742328432" +unicode(7) "unicode" +-- Iteration 21 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "-1e-2" +unicode(7) "unicode" +-- Iteration 22 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 23 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) "-1" +unicode(7) "unicode" +-- Iteration 24 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 25 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(2) " 1" +unicode(7) "unicode" +-- Iteration 26 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(22) "2974394749328742328432" +unicode(7) "unicode" +-- Iteration 27 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "-1e-2" +unicode(7) "unicode" +-- Iteration 28 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(4) "0xff" +unicode(7) "unicode" +-- Iteration 29 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(4) "0x55" +unicode(7) "unicode" +-- Iteration 30 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "0XA55" +unicode(7) "unicode" +-- Iteration 31 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "0X123" +unicode(7) "unicode" +-- Iteration 32 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(4) "0123" +unicode(7) "unicode" +-- Iteration 33 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(4) "0123" +unicode(7) "unicode" +-- Iteration 34 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "-0123" +unicode(7) "unicode" +-- Iteration 35 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "+0123" +unicode(7) "unicode" +-- Iteration 36 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "-0123" +unicode(7) "unicode" +-- Iteration 37 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(5) "+0123" +unicode(7) "unicode" +-- Iteration 38 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(8) "-0x80001" +unicode(7) "unicode" +-- Iteration 39 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(8) "+0x80001" +unicode(7) "unicode" +-- Iteration 40 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(10) "-0x80001.5" +unicode(7) "unicode" +-- Iteration 41 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(9) "0x80001.5" +unicode(7) "unicode" +-- Iteration 42 -- +unicode(7) "unicode" +2: settype(): Cannot convert to resource type +bool(false) +unicode(12) "@$%#$%^$%^&^" +unicode(7) "unicode" +-- Iteration 43 -- +unicode(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(0) { +} +unicode(5) "array" +-- Iteration 44 -- +unicode(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(1) { + [0]=> + NULL +} +unicode(5) "array" +-- Iteration 45 -- +unicode(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +unicode(5) "array" +-- Iteration 46 -- +unicode(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(4) { + [1]=> + unicode(3) "one" + [2]=> + unicode(3) "two" + [3]=> + unicode(5) "three" + [u"four"]=> + int(4) +} +unicode(5) "array" +-- Iteration 47 -- +unicode(5) "array" +2: settype(): Cannot convert to resource type +bool(false) +array(3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +unicode(5) "array" +-- Iteration 48 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-2147483648) +unicode(6) "double" +-- Iteration 49 -- +unicode(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(2147483647) +unicode(7) "integer" +-- Iteration 50 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(2147483649) +unicode(6) "double" +-- Iteration 51 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(1232147483649) +unicode(6) "double" +-- Iteration 52 -- +unicode(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(85) +unicode(7) "integer" +-- Iteration 53 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(1058513956921) +unicode(6) "double" +-- Iteration 54 -- +unicode(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(-21903) +unicode(7) "integer" +-- Iteration 55 -- +unicode(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(365) +unicode(7) "integer" +-- Iteration 56 -- +unicode(7) "integer" +2: settype(): Cannot convert to resource type +bool(false) +int(-365) +unicode(7) "integer" +-- Iteration 57 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(80561044571754) +unicode(6) "double" +-- Iteration 58 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(100000) +unicode(6) "double" +-- Iteration 59 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-100000) +unicode(6) "double" +-- Iteration 60 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(100000) +unicode(6) "double" +-- Iteration 61 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-100000) +unicode(6) "double" +-- Iteration 62 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-1.5) +unicode(6) "double" +-- Iteration 63 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(0.5) +unicode(6) "double" +-- Iteration 64 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-0.5) +unicode(6) "double" +-- Iteration 65 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(500000) +unicode(6) "double" +-- Iteration 66 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-500000) +unicode(6) "double" +-- Iteration 67 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-5.0E-7) +unicode(6) "double" +-- Iteration 68 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(500000) +unicode(6) "double" +-- Iteration 69 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-500000) +unicode(6) "double" +-- Iteration 70 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(512000) +unicode(6) "double" +-- Iteration 71 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-512000) +unicode(6) "double" +-- Iteration 72 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(5.12E-7) +unicode(6) "double" +-- Iteration 73 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(5.12E-7) +unicode(6) "double" +-- Iteration 74 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(512000) +unicode(6) "double" +-- Iteration 75 -- +unicode(6) "double" +2: settype(): Cannot convert to resource type +bool(false) +float(-512000) +unicode(6) "double" +-- Iteration 76 -- +unicode(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#1 (2) { + [u"x"]=> + NULL + [u"y"]=> + NULL +} +unicode(6) "object" +-- Iteration 77 -- +unicode(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#2 (2) { + [u"x"]=> + float(2.5) + [u"y"]=> + float(40.5) +} +unicode(6) "object" +-- Iteration 78 -- +unicode(6) "object" +2: settype(): Cannot convert to resource type +bool(false) +object(point)#3 (2) { + [u"x"]=> + int(0) + [u"y"]=> + int(0) +} +unicode(6) "object" +-- Iteration 79 -- +unicode(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +unicode(4) "NULL" +-- Iteration 80 -- +unicode(4) "NULL" +2: settype(): Cannot convert to resource type +bool(false) +NULL +unicode(4) "NULL" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt new file mode 100644 index 0000000000..ec3d3c7214 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt @@ -0,0 +1,1691 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +/* test conversion to array type */ +$type = "array"; + +echo "\n*** Testing gettype() & settype() functions : usage variations ***\n"; +echo "\n-- Setting type of data to $type --\n"; + +$loop_count = 1; +foreach ($var_values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to null + var_dump( settype($var, $type) ); + + // dump the converted data + var_dump( $var ); + + // check the new type after conversion + var_dump( gettype($var) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to array -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +array(0) { +} +string(5) "array" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(false) +} +string(5) "array" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(true) +} +string(5) "array" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(true) +} +string(5) "array" +-- Iteration 5 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) "ÿ" +} +string(5) "array" +-- Iteration 6 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) "f" +} +string(5) "array" +-- Iteration 7 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) " +3" +} +string(5) "array" +-- Iteration 8 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(0) "" +} +string(5) "array" +-- Iteration 9 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(0) "" +} +string(5) "array" +-- Iteration 10 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) " " +} +string(5) "array" +-- Iteration 11 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) " " +} +string(5) "array" +-- Iteration 12 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) "10" +} +string(5) "array" +-- Iteration 13 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) "10" +} +string(5) "array" +-- Iteration 14 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +-- Iteration 15 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +-- Iteration 16 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) "1" +} +string(5) "array" +-- Iteration 17 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) "-1" +} +string(5) "array" +-- Iteration 18 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +string(5) "array" +-- Iteration 19 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) " 1" +} +string(5) "array" +-- Iteration 20 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(22) "2974394749328742328432" +} +string(5) "array" +-- Iteration 21 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-1e-2" +} +string(5) "array" +-- Iteration 22 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(1) "1" +} +string(5) "array" +-- Iteration 23 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) "-1" +} +string(5) "array" +-- Iteration 24 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +string(5) "array" +-- Iteration 25 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(2) " 1" +} +string(5) "array" +-- Iteration 26 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(22) "2974394749328742328432" +} +string(5) "array" +-- Iteration 27 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-1e-2" +} +string(5) "array" +-- Iteration 28 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0xff" +} +string(5) "array" +-- Iteration 29 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0x55" +} +string(5) "array" +-- Iteration 30 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "0XA55" +} +string(5) "array" +-- Iteration 31 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "0X123" +} +string(5) "array" +-- Iteration 32 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0123" +} +string(5) "array" +-- Iteration 33 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0123" +} +string(5) "array" +-- Iteration 34 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-0123" +} +string(5) "array" +-- Iteration 35 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "+0123" +} +string(5) "array" +-- Iteration 36 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-0123" +} +string(5) "array" +-- Iteration 37 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "+0123" +} +string(5) "array" +-- Iteration 38 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "-0x80001" +} +string(5) "array" +-- Iteration 39 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "+0x80001" +} +string(5) "array" +-- Iteration 40 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(10) "-0x80001.5" +} +string(5) "array" +-- Iteration 41 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(9) "0x80001.5" +} +string(5) "array" +-- Iteration 42 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(12) "@$%#$%^$%^&^" +} +string(5) "array" +-- Iteration 43 -- +string(5) "array" +bool(true) +array(0) { +} +string(5) "array" +-- Iteration 44 -- +string(5) "array" +bool(true) +array(1) { + [0]=> + NULL +} +string(5) "array" +-- Iteration 45 -- +string(5) "array" +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +string(5) "array" +-- Iteration 46 -- +string(5) "array" +bool(true) +array(4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + ["four"]=> + int(4) +} +string(5) "array" +-- Iteration 47 -- +string(5) "array" +bool(true) +array(3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +string(5) "array" +-- Iteration 48 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-2147483648) +} +string(5) "array" +-- Iteration 49 -- +string(7) "integer" +bool(true) +array(1) { + [0]=> + int(2147483647) +} +string(5) "array" +-- Iteration 50 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(2147483649) +} +string(5) "array" +-- Iteration 51 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(1232147483649) +} +string(5) "array" +-- Iteration 52 -- +string(7) "integer" +bool(true) +array(1) { + [0]=> + int(85) +} +string(5) "array" +-- Iteration 53 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(1058513956921) +} +string(5) "array" +-- Iteration 54 -- +string(7) "integer" +bool(true) +array(1) { + [0]=> + int(-21903) +} +string(5) "array" +-- Iteration 55 -- +string(7) "integer" +bool(true) +array(1) { + [0]=> + int(365) +} +string(5) "array" +-- Iteration 56 -- +string(7) "integer" +bool(true) +array(1) { + [0]=> + int(-365) +} +string(5) "array" +-- Iteration 57 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(80561044571754) +} +string(5) "array" +-- Iteration 58 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(100000) +} +string(5) "array" +-- Iteration 59 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-100000) +} +string(5) "array" +-- Iteration 60 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(100000) +} +string(5) "array" +-- Iteration 61 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-100000) +} +string(5) "array" +-- Iteration 62 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-1.5) +} +string(5) "array" +-- Iteration 63 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(0.5) +} +string(5) "array" +-- Iteration 64 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-0.5) +} +string(5) "array" +-- Iteration 65 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(500000) +} +string(5) "array" +-- Iteration 66 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-500000) +} +string(5) "array" +-- Iteration 67 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-5.0E-7) +} +string(5) "array" +-- Iteration 68 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(500000) +} +string(5) "array" +-- Iteration 69 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-500000) +} +string(5) "array" +-- Iteration 70 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(512000) +} +string(5) "array" +-- Iteration 71 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-512000) +} +string(5) "array" +-- Iteration 72 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(5.12E-7) +} +string(5) "array" +-- Iteration 73 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(5.12E-7) +} +string(5) "array" +-- Iteration 74 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(512000) +} +string(5) "array" +-- Iteration 75 -- +string(6) "double" +bool(true) +array(1) { + [0]=> + float(-512000) +} +string(5) "array" +-- Iteration 76 -- +string(6) "object" +bool(true) +array(2) { + ["x"]=> + NULL + ["y"]=> + NULL +} +string(5) "array" +-- Iteration 77 -- +string(6) "object" +bool(true) +array(2) { + ["x"]=> + float(2.5) + ["y"]=> + float(40.5) +} +string(5) "array" +-- Iteration 78 -- +string(6) "object" +bool(true) +array(2) { + ["x"]=> + int(0) + ["y"]=> + int(0) +} +string(5) "array" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +array(0) { +} +string(5) "array" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +array(0) { +} +string(5) "array" +-- Iteration 81 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +-- Iteration 82 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +-- Iteration 83 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "+0123" +} +string(5) "array" +-- Iteration 84 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-0123" +} +string(5) "array" +-- Iteration 85 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0xff" +} +string(5) "array" +-- Iteration 86 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0x55" +} +string(5) "array" +-- Iteration 87 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +string(5) "array" +-- Iteration 88 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(22) "2974394749328742328432" +} +string(5) "array" +-- Iteration 89 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +string(5) "array" +-- Iteration 90 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +-- Iteration 91 -- +string(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +string(5) "array" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to array -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +array(0) { +} +unicode(5) "array" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(false) +} +unicode(5) "array" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(true) +} +unicode(5) "array" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +array(1) { + [0]=> + bool(true) +} +unicode(5) "array" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) "ÿ" +} +unicode(5) "array" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) "f" +} +unicode(5) "array" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) " +3" +} +unicode(5) "array" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(0) "" +} +unicode(5) "array" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(0) "" +} +unicode(5) "array" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) " " +} +unicode(5) "array" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) " " +} +unicode(5) "array" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) "10" +} +unicode(5) "array" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) "10" +} +unicode(5) "array" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(8) "10string" +} +unicode(5) "array" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(8) "10string" +} +unicode(5) "array" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) "1" +} +unicode(5) "array" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) "-1" +} +unicode(5) "array" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(3) "1e2" +} +unicode(5) "array" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) " 1" +} +unicode(5) "array" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(22) "2974394749328742328432" +} +unicode(5) "array" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "-1e-2" +} +unicode(5) "array" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(1) "1" +} +unicode(5) "array" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) "-1" +} +unicode(5) "array" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(3) "1e2" +} +unicode(5) "array" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(2) " 1" +} +unicode(5) "array" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(22) "2974394749328742328432" +} +unicode(5) "array" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "-1e-2" +} +unicode(5) "array" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(4) "0xff" +} +unicode(5) "array" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(4) "0x55" +} +unicode(5) "array" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "0XA55" +} +unicode(5) "array" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "0X123" +} +unicode(5) "array" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(4) "0123" +} +unicode(5) "array" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(4) "0123" +} +unicode(5) "array" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "-0123" +} +unicode(5) "array" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "+0123" +} +unicode(5) "array" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "-0123" +} +unicode(5) "array" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(5) "+0123" +} +unicode(5) "array" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(8) "-0x80001" +} +unicode(5) "array" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(8) "+0x80001" +} +unicode(5) "array" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(10) "-0x80001.5" +} +unicode(5) "array" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(9) "0x80001.5" +} +unicode(5) "array" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +array(1) { + [0]=> + unicode(12) "@$%#$%^$%^&^" +} +unicode(5) "array" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +array(0) { +} +unicode(5) "array" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +array(1) { + [0]=> + NULL +} +unicode(5) "array" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +unicode(5) "array" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +array(4) { + [1]=> + unicode(3) "one" + [2]=> + unicode(3) "two" + [3]=> + unicode(5) "three" + [u"four"]=> + int(4) +} +unicode(5) "array" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +array(3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +unicode(5) "array" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-2147483648) +} +unicode(5) "array" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +array(1) { + [0]=> + int(2147483647) +} +unicode(5) "array" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(2147483649) +} +unicode(5) "array" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(1232147483649) +} +unicode(5) "array" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +array(1) { + [0]=> + int(85) +} +unicode(5) "array" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(1058513956921) +} +unicode(5) "array" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +array(1) { + [0]=> + int(-21903) +} +unicode(5) "array" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +array(1) { + [0]=> + int(365) +} +unicode(5) "array" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +array(1) { + [0]=> + int(-365) +} +unicode(5) "array" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(80561044571754) +} +unicode(5) "array" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(100000) +} +unicode(5) "array" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-100000) +} +unicode(5) "array" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(100000) +} +unicode(5) "array" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-100000) +} +unicode(5) "array" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-1.5) +} +unicode(5) "array" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(0.5) +} +unicode(5) "array" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-0.5) +} +unicode(5) "array" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(500000) +} +unicode(5) "array" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-500000) +} +unicode(5) "array" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-5.0E-7) +} +unicode(5) "array" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(500000) +} +unicode(5) "array" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-500000) +} +unicode(5) "array" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(512000) +} +unicode(5) "array" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-512000) +} +unicode(5) "array" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(5.12E-7) +} +unicode(5) "array" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(5.12E-7) +} +unicode(5) "array" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(512000) +} +unicode(5) "array" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +array(1) { + [0]=> + float(-512000) +} +unicode(5) "array" +-- Iteration 76 -- +unicode(6) "object" +bool(true) +array(2) { + [u"x"]=> + NULL + [u"y"]=> + NULL +} +unicode(5) "array" +-- Iteration 77 -- +unicode(6) "object" +bool(true) +array(2) { + [u"x"]=> + float(2.5) + [u"y"]=> + float(40.5) +} +unicode(5) "array" +-- Iteration 78 -- +unicode(6) "object" +bool(true) +array(2) { + [u"x"]=> + int(0) + [u"y"]=> + int(0) +} +unicode(5) "array" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +array(0) { +} +unicode(5) "array" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +array(0) { +} +unicode(5) "array" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +unicode(5) "array" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +unicode(5) "array" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "+0123" +} +unicode(5) "array" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(5) "-0123" +} +unicode(5) "array" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0xff" +} +unicode(5) "array" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(4) "0x55" +} +unicode(5) "array" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +unicode(5) "array" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(22) "2974394749328742328432" +} +unicode(5) "array" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(3) "1e2" +} +unicode(5) "array" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +unicode(5) "array" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +array(1) { + [0]=> + string(8) "10string" +} +unicode(5) "array" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt new file mode 100644 index 0000000000..41d0d11930 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt @@ -0,0 +1,1690 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +/* test conversion to object type */ +$type = "object"; + +echo "\n*** Testing gettype() & settype() functions : usage variations ***\n"; +echo "\n-- Setting type of data to $type --\n"; +$loop_count = 1; +foreach ($var_values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to null + var_dump( settype($var, $type) ); + + // dump the converted data + var_dump( $var ); + + // check the new type after conversion + var_dump( gettype($var) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to object -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +string(6) "object" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + bool(false) +} +string(6) "object" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + bool(true) +} +string(6) "object" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + bool(true) +} +string(6) "object" +-- Iteration 5 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) "ÿ" +} +string(6) "object" +-- Iteration 6 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) "f" +} +string(6) "object" +-- Iteration 7 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) " +3" +} +string(6) "object" +-- Iteration 8 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(0) "" +} +string(6) "object" +-- Iteration 9 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(0) "" +} +string(6) "object" +-- Iteration 10 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) " " +} +string(6) "object" +-- Iteration 11 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) " " +} +string(6) "object" +-- Iteration 12 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) "10" +} +string(6) "object" +-- Iteration 13 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) "10" +} +string(6) "object" +-- Iteration 14 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +-- Iteration 15 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +-- Iteration 16 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) "1" +} +string(6) "object" +-- Iteration 17 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) "-1" +} +string(6) "object" +-- Iteration 18 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(3) "1e2" +} +string(6) "object" +-- Iteration 19 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) " 1" +} +string(6) "object" +-- Iteration 20 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(22) "2974394749328742328432" +} +string(6) "object" +-- Iteration 21 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "-1e-2" +} +string(6) "object" +-- Iteration 22 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(1) "1" +} +string(6) "object" +-- Iteration 23 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) "-1" +} +string(6) "object" +-- Iteration 24 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(3) "1e2" +} +string(6) "object" +-- Iteration 25 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(2) " 1" +} +string(6) "object" +-- Iteration 26 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(22) "2974394749328742328432" +} +string(6) "object" +-- Iteration 27 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "-1e-2" +} +string(6) "object" +-- Iteration 28 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0xff" +} +string(6) "object" +-- Iteration 29 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0x55" +} +string(6) "object" +-- Iteration 30 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "0XA55" +} +string(6) "object" +-- Iteration 31 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "0X123" +} +string(6) "object" +-- Iteration 32 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0123" +} +string(6) "object" +-- Iteration 33 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0123" +} +string(6) "object" +-- Iteration 34 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "-0123" +} +string(6) "object" +-- Iteration 35 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "+0123" +} +string(6) "object" +-- Iteration 36 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "-0123" +} +string(6) "object" +-- Iteration 37 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "+0123" +} +string(6) "object" +-- Iteration 38 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "-0x80001" +} +string(6) "object" +-- Iteration 39 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "+0x80001" +} +string(6) "object" +-- Iteration 40 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(10) "-0x80001.5" +} +string(6) "object" +-- Iteration 41 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(9) "0x80001.5" +} +string(6) "object" +-- Iteration 42 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(12) "@$%#$%^$%^&^" +} +string(6) "object" +-- Iteration 43 -- +string(5) "array" +bool(true) +object(stdClass)#4 (0) { +} +string(6) "object" +-- Iteration 44 -- +string(5) "array" +bool(true) +object(stdClass)#4 (1) { + [0]=> + NULL +} +string(6) "object" +-- Iteration 45 -- +string(5) "array" +bool(true) +object(stdClass)#4 (4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +string(6) "object" +-- Iteration 46 -- +string(5) "array" +bool(true) +object(stdClass)#4 (4) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + ["four"]=> + int(4) +} +string(6) "object" +-- Iteration 47 -- +string(5) "array" +bool(true) +object(stdClass)#4 (3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +string(6) "object" +-- Iteration 48 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-2147483648) +} +string(6) "object" +-- Iteration 49 -- +string(7) "integer" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + int(2147483647) +} +string(6) "object" +-- Iteration 50 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(2147483649) +} +string(6) "object" +-- Iteration 51 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(1232147483649) +} +string(6) "object" +-- Iteration 52 -- +string(7) "integer" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + int(85) +} +string(6) "object" +-- Iteration 53 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(1058513956921) +} +string(6) "object" +-- Iteration 54 -- +string(7) "integer" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + int(-21903) +} +string(6) "object" +-- Iteration 55 -- +string(7) "integer" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + int(365) +} +string(6) "object" +-- Iteration 56 -- +string(7) "integer" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + int(-365) +} +string(6) "object" +-- Iteration 57 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(80561044571754) +} +string(6) "object" +-- Iteration 58 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(100000) +} +string(6) "object" +-- Iteration 59 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-100000) +} +string(6) "object" +-- Iteration 60 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(100000) +} +string(6) "object" +-- Iteration 61 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-100000) +} +string(6) "object" +-- Iteration 62 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-1.5) +} +string(6) "object" +-- Iteration 63 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(0.5) +} +string(6) "object" +-- Iteration 64 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-0.5) +} +string(6) "object" +-- Iteration 65 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(500000) +} +string(6) "object" +-- Iteration 66 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-500000) +} +string(6) "object" +-- Iteration 67 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-5.0E-7) +} +string(6) "object" +-- Iteration 68 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(500000) +} +string(6) "object" +-- Iteration 69 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-500000) +} +string(6) "object" +-- Iteration 70 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(512000) +} +string(6) "object" +-- Iteration 71 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-512000) +} +string(6) "object" +-- Iteration 72 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(5.12E-7) +} +string(6) "object" +-- Iteration 73 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(5.12E-7) +} +string(6) "object" +-- Iteration 74 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(512000) +} +string(6) "object" +-- Iteration 75 -- +string(6) "double" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + float(-512000) +} +string(6) "object" +-- Iteration 76 -- +string(6) "object" +bool(true) +object(point)#1 (2) { + ["x"]=> + NULL + ["y"]=> + NULL +} +string(6) "object" +-- Iteration 77 -- +string(6) "object" +bool(true) +object(point)#2 (2) { + ["x"]=> + float(2.5) + ["y"]=> + float(40.5) +} +string(6) "object" +-- Iteration 78 -- +string(6) "object" +bool(true) +object(point)#3 (2) { + ["x"]=> + int(0) + ["y"]=> + int(0) +} +string(6) "object" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +string(6) "object" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +string(6) "object" +-- Iteration 81 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +-- Iteration 82 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +-- Iteration 83 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "+0123" +} +string(6) "object" +-- Iteration 84 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(5) "-0123" +} +string(6) "object" +-- Iteration 85 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0xff" +} +string(6) "object" +-- Iteration 86 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(4) "0x55" +} +string(6) "object" +-- Iteration 87 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(3) "1e2" +} +string(6) "object" +-- Iteration 88 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(22) "2974394749328742328432" +} +string(6) "object" +-- Iteration 89 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(3) "1e2" +} +string(6) "object" +-- Iteration 90 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +-- Iteration 91 -- +string(6) "string" +bool(true) +object(stdClass)#4 (1) { + ["scalar"]=> + string(8) "10string" +} +string(6) "object" +Done +--UEXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to object -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +unicode(6) "object" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + bool(false) +} +unicode(6) "object" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + bool(true) +} +unicode(6) "object" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + bool(true) +} +unicode(6) "object" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) "ÿ" +} +unicode(6) "object" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) "f" +} +unicode(6) "object" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) " +3" +} +unicode(6) "object" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(0) "" +} +unicode(6) "object" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(0) "" +} +unicode(6) "object" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) " " +} +unicode(6) "object" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) " " +} +unicode(6) "object" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) "10" +} +unicode(6) "object" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) "10" +} +unicode(6) "object" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(8) "10string" +} +unicode(6) "object" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(8) "10string" +} +unicode(6) "object" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) "1" +} +unicode(6) "object" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) "-1" +} +unicode(6) "object" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(3) "1e2" +} +unicode(6) "object" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) " 1" +} +unicode(6) "object" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(22) "2974394749328742328432" +} +unicode(6) "object" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "-1e-2" +} +unicode(6) "object" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(1) "1" +} +unicode(6) "object" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) "-1" +} +unicode(6) "object" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(3) "1e2" +} +unicode(6) "object" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(2) " 1" +} +unicode(6) "object" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(22) "2974394749328742328432" +} +unicode(6) "object" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "-1e-2" +} +unicode(6) "object" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(4) "0xff" +} +unicode(6) "object" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(4) "0x55" +} +unicode(6) "object" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "0XA55" +} +unicode(6) "object" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "0X123" +} +unicode(6) "object" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(4) "0123" +} +unicode(6) "object" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(4) "0123" +} +unicode(6) "object" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "-0123" +} +unicode(6) "object" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "+0123" +} +unicode(6) "object" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "-0123" +} +unicode(6) "object" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(5) "+0123" +} +unicode(6) "object" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(8) "-0x80001" +} +unicode(6) "object" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(8) "+0x80001" +} +unicode(6) "object" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(10) "-0x80001.5" +} +unicode(6) "object" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(9) "0x80001.5" +} +unicode(6) "object" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + unicode(12) "@$%#$%^$%^&^" +} +unicode(6) "object" +-- Iteration 43 -- +unicode(5) "array" +bool(true) +object(stdClass)#4 (0) { +} +unicode(6) "object" +-- Iteration 44 -- +unicode(5) "array" +bool(true) +object(stdClass)#4 (1) { + [0]=> + NULL +} +unicode(6) "object" +-- Iteration 45 -- +unicode(5) "array" +bool(true) +object(stdClass)#4 (4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +unicode(6) "object" +-- Iteration 46 -- +unicode(5) "array" +bool(true) +object(stdClass)#4 (4) { + [1]=> + unicode(3) "one" + [2]=> + unicode(3) "two" + [3]=> + unicode(5) "three" + [u"four"]=> + int(4) +} +unicode(6) "object" +-- Iteration 47 -- +unicode(5) "array" +bool(true) +object(stdClass)#4 (3) { + [0]=> + float(1.5) + [1]=> + float(2.4) + [2]=> + float(6500000) +} +unicode(6) "object" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-2147483648) +} +unicode(6) "object" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + int(2147483647) +} +unicode(6) "object" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(2147483649) +} +unicode(6) "object" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(1232147483649) +} +unicode(6) "object" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + int(85) +} +unicode(6) "object" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(1058513956921) +} +unicode(6) "object" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + int(-21903) +} +unicode(6) "object" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + int(365) +} +unicode(6) "object" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + int(-365) +} +unicode(6) "object" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(80561044571754) +} +unicode(6) "object" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(100000) +} +unicode(6) "object" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-100000) +} +unicode(6) "object" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(100000) +} +unicode(6) "object" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-100000) +} +unicode(6) "object" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-1.5) +} +unicode(6) "object" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(0.5) +} +unicode(6) "object" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-0.5) +} +unicode(6) "object" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(500000) +} +unicode(6) "object" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-500000) +} +unicode(6) "object" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-5.0E-7) +} +unicode(6) "object" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(500000) +} +unicode(6) "object" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-500000) +} +unicode(6) "object" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(512000) +} +unicode(6) "object" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-512000) +} +unicode(6) "object" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(5.12E-7) +} +unicode(6) "object" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(5.12E-7) +} +unicode(6) "object" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(512000) +} +unicode(6) "object" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + float(-512000) +} +unicode(6) "object" +-- Iteration 76 -- +unicode(6) "object" +bool(true) +object(point)#1 (2) { + [u"x"]=> + NULL + [u"y"]=> + NULL +} +unicode(6) "object" +-- Iteration 77 -- +unicode(6) "object" +bool(true) +object(point)#2 (2) { + [u"x"]=> + float(2.5) + [u"y"]=> + float(40.5) +} +unicode(6) "object" +-- Iteration 78 -- +unicode(6) "object" +bool(true) +object(point)#3 (2) { + [u"x"]=> + int(0) + [u"y"]=> + int(0) +} +unicode(6) "object" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +unicode(6) "object" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +object(stdClass)#4 (0) { +} +unicode(6) "object" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(8) "10string" +} +unicode(6) "object" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(8) "10string" +} +unicode(6) "object" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(5) "+0123" +} +unicode(6) "object" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(5) "-0123" +} +unicode(6) "object" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(4) "0xff" +} +unicode(6) "object" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(4) "0x55" +} +unicode(6) "object" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(3) "1e2" +} +unicode(6) "object" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(22) "2974394749328742328432" +} +unicode(6) "object" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(3) "1e2" +} +unicode(6) "object" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(8) "10string" +} +unicode(6) "object" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +object(stdClass)#4 (1) { + [u"scalar"]=> + string(8) "10string" +} +unicode(6) "object" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt new file mode 100644 index 0000000000..d7a66eb1e9 --- /dev/null +++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt @@ -0,0 +1,1126 @@ +--TEST-- +Test gettype() & settype() functions : usage variations +--FILE-- +x = $x; + $this->y = $y; + } + + function __toString() { + return "ObjectPoint"; + } +} + +$var_values = array ( + /* nulls */ + null, + + /* boolean */ + FALSE, + TRUE, + true, + + /* strings */ + "\xFF", + "\x66", + "\0123", + "", + '', + " ", + ' ', + /* numerics in the form of string */ + '10', + "10", + "10string", + '10string', + "1", + "-1", + "1e2", + " 1", + "2974394749328742328432", + "-1e-2", + '1', + '-1', + '1e2', + ' 1', + '2974394749328742328432', + '-1e-2', + "0xff", + '0x55', + '0XA55', + '0X123', + "0123", + '0123', + "-0123", + "+0123", + '-0123', + '+0123', + "-0x80001", // invalid numerics as its prefix with sign or have decimal points + "+0x80001", + "-0x80001.5", + "0x80001.5", + "@$%#$%^$%^&^", + + /* arrays */ + array(), + array(NULL), + array(1,2,3,4), + array(1 => "one", 2 => "two", "3" => "three", "four" => 4), + array(1.5, 2.4, 6.5e6), + + /* integers */ + -2147483648, // max -ne int value + 2147483647, + 2147483649, + 1232147483649, + 0x55, + 0xF674593039, // a hex value > than max int + -0X558F, + 0555, + -0555, + 02224242434343152, // an octal value > than max int + + /* floats */ + 1e5, + -1e5, + 1E5, + -1E5, + -1.5, + .5, + -.5, + .5e6, + -.5e6, + -.5e-6, + .5e+6, + -.5e+6, + .512E6, + -.512E6, + .512E-6, + +.512E-6, + .512E+6, + -.512E+6, + + new point(NULL, NULL), + new point(2.5, 40.5), + new point(0, 0), + + /* undefined/unset vars */ + $unset_var, + $undef_var, + + /* binary strings */ + b"10string", + b'10string', + b"+0123", + b'-0123', + b"0xff", + b'0x55', + b'1e2', + b'2974394749328742328432', + b"1e2", + b'10string', + b"10string" +); + +/* test conversion to string type */ +$type = "string"; + +echo "\n*** Testing gettype() & settype() functions : usage variations ***\n"; +echo "\n-- Setting type of data to $type --\n"; +$loop_count = 1; +foreach ($var_values as $var) { + echo "-- Iteration $loop_count --\n"; $loop_count++; + + // get the current data type + var_dump( gettype($var) ); + + // convert it to null + var_dump( settype($var, $type) ); + + // dump the converted data + var_dump( $var ); + + // check the new type after conversion + var_dump( gettype($var) ); +} + +echo "Done\n"; +?> +--EXPECTF-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to string -- +-- Iteration 1 -- +string(4) "NULL" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 2 -- +string(7) "boolean" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 3 -- +string(7) "boolean" +bool(true) +string(1) "1" +string(6) "string" +-- Iteration 4 -- +string(7) "boolean" +bool(true) +string(1) "1" +string(6) "string" +-- Iteration 5 -- +string(6) "string" +bool(true) +string(1) "ÿ" +string(6) "string" +-- Iteration 6 -- +string(6) "string" +bool(true) +string(1) "f" +string(6) "string" +-- Iteration 7 -- +string(6) "string" +bool(true) +string(2) " +3" +string(6) "string" +-- Iteration 8 -- +string(6) "string" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 9 -- +string(6) "string" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 10 -- +string(6) "string" +bool(true) +string(1) " " +string(6) "string" +-- Iteration 11 -- +string(6) "string" +bool(true) +string(1) " " +string(6) "string" +-- Iteration 12 -- +string(6) "string" +bool(true) +string(2) "10" +string(6) "string" +-- Iteration 13 -- +string(6) "string" +bool(true) +string(2) "10" +string(6) "string" +-- Iteration 14 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +-- Iteration 15 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +-- Iteration 16 -- +string(6) "string" +bool(true) +string(1) "1" +string(6) "string" +-- Iteration 17 -- +string(6) "string" +bool(true) +string(2) "-1" +string(6) "string" +-- Iteration 18 -- +string(6) "string" +bool(true) +string(3) "1e2" +string(6) "string" +-- Iteration 19 -- +string(6) "string" +bool(true) +string(2) " 1" +string(6) "string" +-- Iteration 20 -- +string(6) "string" +bool(true) +string(22) "2974394749328742328432" +string(6) "string" +-- Iteration 21 -- +string(6) "string" +bool(true) +string(5) "-1e-2" +string(6) "string" +-- Iteration 22 -- +string(6) "string" +bool(true) +string(1) "1" +string(6) "string" +-- Iteration 23 -- +string(6) "string" +bool(true) +string(2) "-1" +string(6) "string" +-- Iteration 24 -- +string(6) "string" +bool(true) +string(3) "1e2" +string(6) "string" +-- Iteration 25 -- +string(6) "string" +bool(true) +string(2) " 1" +string(6) "string" +-- Iteration 26 -- +string(6) "string" +bool(true) +string(22) "2974394749328742328432" +string(6) "string" +-- Iteration 27 -- +string(6) "string" +bool(true) +string(5) "-1e-2" +string(6) "string" +-- Iteration 28 -- +string(6) "string" +bool(true) +string(4) "0xff" +string(6) "string" +-- Iteration 29 -- +string(6) "string" +bool(true) +string(4) "0x55" +string(6) "string" +-- Iteration 30 -- +string(6) "string" +bool(true) +string(5) "0XA55" +string(6) "string" +-- Iteration 31 -- +string(6) "string" +bool(true) +string(5) "0X123" +string(6) "string" +-- Iteration 32 -- +string(6) "string" +bool(true) +string(4) "0123" +string(6) "string" +-- Iteration 33 -- +string(6) "string" +bool(true) +string(4) "0123" +string(6) "string" +-- Iteration 34 -- +string(6) "string" +bool(true) +string(5) "-0123" +string(6) "string" +-- Iteration 35 -- +string(6) "string" +bool(true) +string(5) "+0123" +string(6) "string" +-- Iteration 36 -- +string(6) "string" +bool(true) +string(5) "-0123" +string(6) "string" +-- Iteration 37 -- +string(6) "string" +bool(true) +string(5) "+0123" +string(6) "string" +-- Iteration 38 -- +string(6) "string" +bool(true) +string(8) "-0x80001" +string(6) "string" +-- Iteration 39 -- +string(6) "string" +bool(true) +string(8) "+0x80001" +string(6) "string" +-- Iteration 40 -- +string(6) "string" +bool(true) +string(10) "-0x80001.5" +string(6) "string" +-- Iteration 41 -- +string(6) "string" +bool(true) +string(9) "0x80001.5" +string(6) "string" +-- Iteration 42 -- +string(6) "string" +bool(true) +string(12) "@$%#$%^$%^&^" +string(6) "string" +-- Iteration 43 -- +string(5) "array" +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 44 -- +string(5) "array" +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 45 -- +string(5) "array" +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 46 -- +string(5) "array" +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 47 -- +string(5) "array" +8: Array to string conversion +bool(true) +string(5) "Array" +string(6) "string" +-- Iteration 48 -- +string(6) "double" +bool(true) +string(11) "-2147483648" +string(6) "string" +-- Iteration 49 -- +string(7) "integer" +bool(true) +string(10) "2147483647" +string(6) "string" +-- Iteration 50 -- +string(6) "double" +bool(true) +string(10) "2147483649" +string(6) "string" +-- Iteration 51 -- +string(6) "double" +bool(true) +string(13) "1232147483649" +string(6) "string" +-- Iteration 52 -- +string(7) "integer" +bool(true) +string(2) "85" +string(6) "string" +-- Iteration 53 -- +string(6) "double" +bool(true) +string(13) "1058513956921" +string(6) "string" +-- Iteration 54 -- +string(7) "integer" +bool(true) +string(6) "-21903" +string(6) "string" +-- Iteration 55 -- +string(7) "integer" +bool(true) +string(3) "365" +string(6) "string" +-- Iteration 56 -- +string(7) "integer" +bool(true) +string(4) "-365" +string(6) "string" +-- Iteration 57 -- +string(6) "double" +bool(true) +string(14) "80561044571754" +string(6) "string" +-- Iteration 58 -- +string(6) "double" +bool(true) +string(6) "100000" +string(6) "string" +-- Iteration 59 -- +string(6) "double" +bool(true) +string(7) "-100000" +string(6) "string" +-- Iteration 60 -- +string(6) "double" +bool(true) +string(6) "100000" +string(6) "string" +-- Iteration 61 -- +string(6) "double" +bool(true) +string(7) "-100000" +string(6) "string" +-- Iteration 62 -- +string(6) "double" +bool(true) +string(4) "-1.5" +string(6) "string" +-- Iteration 63 -- +string(6) "double" +bool(true) +string(3) "0.5" +string(6) "string" +-- Iteration 64 -- +string(6) "double" +bool(true) +string(4) "-0.5" +string(6) "string" +-- Iteration 65 -- +string(6) "double" +bool(true) +string(6) "500000" +string(6) "string" +-- Iteration 66 -- +string(6) "double" +bool(true) +string(7) "-500000" +string(6) "string" +-- Iteration 67 -- +string(6) "double" +bool(true) +string(7) "-5.0E-7" +string(6) "string" +-- Iteration 68 -- +string(6) "double" +bool(true) +string(6) "500000" +string(6) "string" +-- Iteration 69 -- +string(6) "double" +bool(true) +string(7) "-500000" +string(6) "string" +-- Iteration 70 -- +string(6) "double" +bool(true) +string(6) "512000" +string(6) "string" +-- Iteration 71 -- +string(6) "double" +bool(true) +string(7) "-512000" +string(6) "string" +-- Iteration 72 -- +string(6) "double" +bool(true) +string(7) "5.12E-7" +string(6) "string" +-- Iteration 73 -- +string(6) "double" +bool(true) +string(7) "5.12E-7" +string(6) "string" +-- Iteration 74 -- +string(6) "double" +bool(true) +string(6) "512000" +string(6) "string" +-- Iteration 75 -- +string(6) "double" +bool(true) +string(7) "-512000" +string(6) "string" +-- Iteration 76 -- +string(6) "object" +bool(true) +string(11) "ObjectPoint" +string(6) "string" +-- Iteration 77 -- +string(6) "object" +bool(true) +string(11) "ObjectPoint" +string(6) "string" +-- Iteration 78 -- +string(6) "object" +bool(true) +string(11) "ObjectPoint" +string(6) "string" +-- Iteration 79 -- +string(4) "NULL" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 80 -- +string(4) "NULL" +bool(true) +string(0) "" +string(6) "string" +-- Iteration 81 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +-- Iteration 82 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +-- Iteration 83 -- +string(6) "string" +bool(true) +string(5) "+0123" +string(6) "string" +-- Iteration 84 -- +string(6) "string" +bool(true) +string(5) "-0123" +string(6) "string" +-- Iteration 85 -- +string(6) "string" +bool(true) +string(4) "0xff" +string(6) "string" +-- Iteration 86 -- +string(6) "string" +bool(true) +string(4) "0x55" +string(6) "string" +-- Iteration 87 -- +string(6) "string" +bool(true) +string(3) "1e2" +string(6) "string" +-- Iteration 88 -- +string(6) "string" +bool(true) +string(22) "2974394749328742328432" +string(6) "string" +-- Iteration 89 -- +string(6) "string" +bool(true) +string(3) "1e2" +string(6) "string" +-- Iteration 90 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +-- Iteration 91 -- +string(6) "string" +bool(true) +string(8) "10string" +string(6) "string" +Done +--UEXPECT-- +8: Undefined variable: unset_var +8: Undefined variable: undef_var + +*** Testing gettype() & settype() functions : usage variations *** + +-- Setting type of data to string -- +-- Iteration 1 -- +unicode(4) "NULL" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 2 -- +unicode(7) "boolean" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 3 -- +unicode(7) "boolean" +bool(true) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 4 -- +unicode(7) "boolean" +bool(true) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 5 -- +unicode(7) "unicode" +bool(true) +unicode(1) "ÿ" +unicode(7) "unicode" +-- Iteration 6 -- +unicode(7) "unicode" +bool(true) +unicode(1) "f" +unicode(7) "unicode" +-- Iteration 7 -- +unicode(7) "unicode" +bool(true) +unicode(2) " +3" +unicode(7) "unicode" +-- Iteration 8 -- +unicode(7) "unicode" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 9 -- +unicode(7) "unicode" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 10 -- +unicode(7) "unicode" +bool(true) +unicode(1) " " +unicode(7) "unicode" +-- Iteration 11 -- +unicode(7) "unicode" +bool(true) +unicode(1) " " +unicode(7) "unicode" +-- Iteration 12 -- +unicode(7) "unicode" +bool(true) +unicode(2) "10" +unicode(7) "unicode" +-- Iteration 13 -- +unicode(7) "unicode" +bool(true) +unicode(2) "10" +unicode(7) "unicode" +-- Iteration 14 -- +unicode(7) "unicode" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 15 -- +unicode(7) "unicode" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 16 -- +unicode(7) "unicode" +bool(true) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 17 -- +unicode(7) "unicode" +bool(true) +unicode(2) "-1" +unicode(7) "unicode" +-- Iteration 18 -- +unicode(7) "unicode" +bool(true) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 19 -- +unicode(7) "unicode" +bool(true) +unicode(2) " 1" +unicode(7) "unicode" +-- Iteration 20 -- +unicode(7) "unicode" +bool(true) +unicode(22) "2974394749328742328432" +unicode(7) "unicode" +-- Iteration 21 -- +unicode(7) "unicode" +bool(true) +unicode(5) "-1e-2" +unicode(7) "unicode" +-- Iteration 22 -- +unicode(7) "unicode" +bool(true) +unicode(1) "1" +unicode(7) "unicode" +-- Iteration 23 -- +unicode(7) "unicode" +bool(true) +unicode(2) "-1" +unicode(7) "unicode" +-- Iteration 24 -- +unicode(7) "unicode" +bool(true) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 25 -- +unicode(7) "unicode" +bool(true) +unicode(2) " 1" +unicode(7) "unicode" +-- Iteration 26 -- +unicode(7) "unicode" +bool(true) +unicode(22) "2974394749328742328432" +unicode(7) "unicode" +-- Iteration 27 -- +unicode(7) "unicode" +bool(true) +unicode(5) "-1e-2" +unicode(7) "unicode" +-- Iteration 28 -- +unicode(7) "unicode" +bool(true) +unicode(4) "0xff" +unicode(7) "unicode" +-- Iteration 29 -- +unicode(7) "unicode" +bool(true) +unicode(4) "0x55" +unicode(7) "unicode" +-- Iteration 30 -- +unicode(7) "unicode" +bool(true) +unicode(5) "0XA55" +unicode(7) "unicode" +-- Iteration 31 -- +unicode(7) "unicode" +bool(true) +unicode(5) "0X123" +unicode(7) "unicode" +-- Iteration 32 -- +unicode(7) "unicode" +bool(true) +unicode(4) "0123" +unicode(7) "unicode" +-- Iteration 33 -- +unicode(7) "unicode" +bool(true) +unicode(4) "0123" +unicode(7) "unicode" +-- Iteration 34 -- +unicode(7) "unicode" +bool(true) +unicode(5) "-0123" +unicode(7) "unicode" +-- Iteration 35 -- +unicode(7) "unicode" +bool(true) +unicode(5) "+0123" +unicode(7) "unicode" +-- Iteration 36 -- +unicode(7) "unicode" +bool(true) +unicode(5) "-0123" +unicode(7) "unicode" +-- Iteration 37 -- +unicode(7) "unicode" +bool(true) +unicode(5) "+0123" +unicode(7) "unicode" +-- Iteration 38 -- +unicode(7) "unicode" +bool(true) +unicode(8) "-0x80001" +unicode(7) "unicode" +-- Iteration 39 -- +unicode(7) "unicode" +bool(true) +unicode(8) "+0x80001" +unicode(7) "unicode" +-- Iteration 40 -- +unicode(7) "unicode" +bool(true) +unicode(10) "-0x80001.5" +unicode(7) "unicode" +-- Iteration 41 -- +unicode(7) "unicode" +bool(true) +unicode(9) "0x80001.5" +unicode(7) "unicode" +-- Iteration 42 -- +unicode(7) "unicode" +bool(true) +unicode(12) "@$%#$%^$%^&^" +unicode(7) "unicode" +-- Iteration 43 -- +unicode(5) "array" +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 44 -- +unicode(5) "array" +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 45 -- +unicode(5) "array" +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 46 -- +unicode(5) "array" +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 47 -- +unicode(5) "array" +8: Array to string conversion +bool(true) +unicode(5) "Array" +unicode(7) "unicode" +-- Iteration 48 -- +unicode(6) "double" +bool(true) +unicode(11) "-2147483648" +unicode(7) "unicode" +-- Iteration 49 -- +unicode(7) "integer" +bool(true) +unicode(10) "2147483647" +unicode(7) "unicode" +-- Iteration 50 -- +unicode(6) "double" +bool(true) +unicode(10) "2147483649" +unicode(7) "unicode" +-- Iteration 51 -- +unicode(6) "double" +bool(true) +unicode(13) "1232147483649" +unicode(7) "unicode" +-- Iteration 52 -- +unicode(7) "integer" +bool(true) +unicode(2) "85" +unicode(7) "unicode" +-- Iteration 53 -- +unicode(6) "double" +bool(true) +unicode(13) "1058513956921" +unicode(7) "unicode" +-- Iteration 54 -- +unicode(7) "integer" +bool(true) +unicode(6) "-21903" +unicode(7) "unicode" +-- Iteration 55 -- +unicode(7) "integer" +bool(true) +unicode(3) "365" +unicode(7) "unicode" +-- Iteration 56 -- +unicode(7) "integer" +bool(true) +unicode(4) "-365" +unicode(7) "unicode" +-- Iteration 57 -- +unicode(6) "double" +bool(true) +unicode(14) "80561044571754" +unicode(7) "unicode" +-- Iteration 58 -- +unicode(6) "double" +bool(true) +unicode(6) "100000" +unicode(7) "unicode" +-- Iteration 59 -- +unicode(6) "double" +bool(true) +unicode(7) "-100000" +unicode(7) "unicode" +-- Iteration 60 -- +unicode(6) "double" +bool(true) +unicode(6) "100000" +unicode(7) "unicode" +-- Iteration 61 -- +unicode(6) "double" +bool(true) +unicode(7) "-100000" +unicode(7) "unicode" +-- Iteration 62 -- +unicode(6) "double" +bool(true) +unicode(4) "-1.5" +unicode(7) "unicode" +-- Iteration 63 -- +unicode(6) "double" +bool(true) +unicode(3) "0.5" +unicode(7) "unicode" +-- Iteration 64 -- +unicode(6) "double" +bool(true) +unicode(4) "-0.5" +unicode(7) "unicode" +-- Iteration 65 -- +unicode(6) "double" +bool(true) +unicode(6) "500000" +unicode(7) "unicode" +-- Iteration 66 -- +unicode(6) "double" +bool(true) +unicode(7) "-500000" +unicode(7) "unicode" +-- Iteration 67 -- +unicode(6) "double" +bool(true) +unicode(7) "-5.0E-7" +unicode(7) "unicode" +-- Iteration 68 -- +unicode(6) "double" +bool(true) +unicode(6) "500000" +unicode(7) "unicode" +-- Iteration 69 -- +unicode(6) "double" +bool(true) +unicode(7) "-500000" +unicode(7) "unicode" +-- Iteration 70 -- +unicode(6) "double" +bool(true) +unicode(6) "512000" +unicode(7) "unicode" +-- Iteration 71 -- +unicode(6) "double" +bool(true) +unicode(7) "-512000" +unicode(7) "unicode" +-- Iteration 72 -- +unicode(6) "double" +bool(true) +unicode(7) "5.12E-7" +unicode(7) "unicode" +-- Iteration 73 -- +unicode(6) "double" +bool(true) +unicode(7) "5.12E-7" +unicode(7) "unicode" +-- Iteration 74 -- +unicode(6) "double" +bool(true) +unicode(6) "512000" +unicode(7) "unicode" +-- Iteration 75 -- +unicode(6) "double" +bool(true) +unicode(7) "-512000" +unicode(7) "unicode" +-- Iteration 76 -- +unicode(6) "object" +bool(true) +unicode(11) "ObjectPoint" +unicode(7) "unicode" +-- Iteration 77 -- +unicode(6) "object" +bool(true) +unicode(11) "ObjectPoint" +unicode(7) "unicode" +-- Iteration 78 -- +unicode(6) "object" +bool(true) +unicode(11) "ObjectPoint" +unicode(7) "unicode" +-- Iteration 79 -- +unicode(4) "NULL" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 80 -- +unicode(4) "NULL" +bool(true) +unicode(0) "" +unicode(7) "unicode" +-- Iteration 81 -- +unicode(6) "string" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 82 -- +unicode(6) "string" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 83 -- +unicode(6) "string" +bool(true) +unicode(5) "+0123" +unicode(7) "unicode" +-- Iteration 84 -- +unicode(6) "string" +bool(true) +unicode(5) "-0123" +unicode(7) "unicode" +-- Iteration 85 -- +unicode(6) "string" +bool(true) +unicode(4) "0xff" +unicode(7) "unicode" +-- Iteration 86 -- +unicode(6) "string" +bool(true) +unicode(4) "0x55" +unicode(7) "unicode" +-- Iteration 87 -- +unicode(6) "string" +bool(true) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 88 -- +unicode(6) "string" +bool(true) +unicode(22) "2974394749328742328432" +unicode(7) "unicode" +-- Iteration 89 -- +unicode(6) "string" +bool(true) +unicode(3) "1e2" +unicode(7) "unicode" +-- Iteration 90 -- +unicode(6) "string" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +-- Iteration 91 -- +unicode(6) "string" +bool(true) +unicode(8) "10string" +unicode(7) "unicode" +Done