3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vs = array(false, true, 1, 0, 1.1, '', 1E52, new stdclass, array(), fopen('php://output', 'r'), null); foreach($vs as $v) var_dump($v, strlen($v));
Output for 8.1.18 - 8.1.27, 8.2.5 - 8.2.17, 8.3.0 - 8.3.4
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(7) Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, stdClass given in /in/lOatl:4 Stack trace: #0 {main} thrown in /in/lOatl on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.17, 8.2.0 - 8.2.4
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(7) Fatal error: Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, stdClass given in /in/lOatl:4 Stack trace: #0 {main} thrown in /in/lOatl on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(7) Warning: strlen() expects parameter 1 to be string, object given in /in/lOatl on line 4 object(stdClass)#1 (0) { } NULL Warning: strlen() expects parameter 1 to be string, array given in /in/lOatl on line 4 array(0) { } NULL Warning: strlen() expects parameter 1 to be string, resource given in /in/lOatl on line 4 resource(5) of type (stream) NULL NULL int(0)
Output for 5.2.2 - 5.2.17
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(7) Catchable fatal error: Object of class stdClass could not be converted to string in /in/lOatl on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.1
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(5) Catchable fatal error: Object of class stdClass could not be converted to string in /in/lOatl on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(5) Notice: Object of class stdClass to string conversion in /in/lOatl on line 4 object(stdClass)#1 (0) { } int(6) Notice: Array to string conversion in /in/lOatl on line 4 array(0) { } int(5) resource(2) of type (stream) int(14) NULL int(0)
Output for 4.3.3 - 4.3.11, 4.4.0 - 4.4.9
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.0E+52) int(5) Notice: Object to string conversion in /in/lOatl on line 4 object(stdClass)(0) { } int(6) Notice: Array to string conversion in /in/lOatl on line 4 array(0) { } int(5) resource(1) of type (stream) int(14) NULL int(0)
Output for 4.3.0 - 4.3.2
bool(false) int(0) bool(true) int(1) int(1) int(1) int(0) int(1) float(1.1) int(3) string(0) "" int(0) float(1.E+52) int(5) Notice: Object to string conversion in /in/lOatl on line 4 object(stdClass)(0) { } int(6) Notice: Array to string conversion in /in/lOatl on line 4 array(0) { } int(5) resource(1) of type (stream) int(14) NULL int(0)

preferences:
216.35 ms | 402 KiB | 326 Q