3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NumberValue { protected $m_unitin = false; } class QuantityValue extends NumberValue { public function __construct() { $this->setUnit(); } protected function setUnit() { assert( '$this->m_unitin != 0' ); $this->m_unitin = 'K'; } public function getUnit() { return $this->m_unitin; } } $quantityValue = new QuantityValue(); echo( $quantityValue->getUnit() );
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
K
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/FfJ3r on line 17 Warning: assert(): Assertion "$this->m_unitin != 0" failed in /in/FfJ3r on line 17 K
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.3.32 - 7.3.33
Warning: assert(): Assertion "$this->m_unitin != 0" failed in /in/FfJ3r on line 17 K

preferences:
206.14 ms | 402 KiB | 229 Q