3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CountMe implements Countable { private $_count; public function __construct($fixedCount) { $this->_count = $fixedCount; } public function count() { return $this->_count; } } $fourtytwo = new CountMe(42); $zero = new CountMe(0); var_dump( count($fourtytwo), count($fourtytwo)==0, empty($fourtytwo), $fourtytwo == array(), $fourtytwo === array() ); print str_repeat('-', 42)."\n"; var_dump( count($zero), count($zero)==0, empty($zero), $zero == array(), $zero === array() );
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of CountMe::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/JqcaY on line 12 int(42) bool(false) bool(false) bool(false) bool(false) ------------------------------------------ int(0) bool(true) bool(false) bool(false) bool(false)

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