3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('str_contains')) { function str_contains(string $haystack, string $needle): bool { return '' === $needle || false !== strpos($haystack, $needle); } }; $types = [ 'string' => 'test', 'int' => 1, 'float' => 1.23, 'null' => null, 'true' => true, 'false' => false, 'object' => new StdClass(), 'array' => [], ]; $result = [ ]; foreach($types as $type => $val) { try { $res = str_contains($val, 'test'); } catch (Error $e) { $res = 'Fatal error triggered'; } $result[$type] = $res; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/LPetC on line 31 array ( 'string' => true, 'int' => false, 'float' => false, 'null' => false, 'true' => false, 'false' => false, 'object' => 'Fatal error triggered', 'array' => 'Fatal error triggered', )

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:
69.37 ms | 402 KiB | 8 Q