3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StringLike { public $value; public function __construct($value) { $this->value = $value; } public function __toString() { return $this->value; } } $haystack = new StringLike('foo'); $needle = 'o'; echo mb_strlen($haystack), "\n"; echo mb_strpos($haystack, $needle), "\n"; $haystack = 123; $needle = 2; echo mb_strlen($haystack), "\n"; echo mb_strpos($haystack, $needle), "\n"; $haystack = null; $needle = 'bar'; echo mb_strlen($haystack), "\n"; echo mb_strpos($haystack, $needle), "\n";
Output for git.master, git.master_jit, rfc.property-hooks
3 1 3 1 Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/bh9aV on line 30 0 Deprecated: mb_strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/bh9aV on line 31

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:
34.57 ms | 406 KiB | 5 Q