3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name = "Anthony"; var_dump( mb_substr(new stdClass, 0, 7), mb_substr($name, "a", 20), mb_substr($name, 20, "b") );
Output for 8.0.0 - 8.0.12, 8.1rc1 - rc3
Fatal error: Uncaught TypeError: mb_substr(): Argument #1 ($string) must be of type string, stdClass given in /in/sH51s:5 Stack trace: #0 /in/sH51s(5): mb_substr(Object(stdClass), 0, 7) #1 {main} thrown in /in/sH51s on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.25
Warning: mb_substr() expects parameter 1 to be string, object given in /in/sH51s on line 5 Warning: mb_substr() expects parameter 2 to be int, string given in /in/sH51s on line 6 Warning: mb_substr() expects parameter 3 to be int, string given in /in/sH51s on line 7 NULL NULL NULL

preferences:
35.25 ms | 461 KiB | 5 Q