3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ToString { public function __toString() { return 'baz'; } } $handle = fopen("php://memory", "r"); var_dump((string) 5); var_dump((string) 1.5); var_dump((string) 'foo'); var_dump((string) null); var_dump((string) true); var_dump((string) false); var_dump((string) new ToString()); var_dump((string) $handle); var_dump((string) new \stdClass);
Output for git.master, git.master_jit, rfc.property-hooks
string(1) "5" string(3) "1.5" string(3) "foo" string(0) "" string(1) "1" string(0) "" string(3) "baz" string(14) "Resource id #5" Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/R0XOp:20 Stack trace: #0 {main} thrown in /in/R0XOp on line 20
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.33 ms | 401 KiB | 8 Q