3v4l.org

run code in 200+ 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' ); $this->m_unitin = 'K'; } public function getUnit() { return $this->m_unitin; } } $quantityValue = new QuantityValue(); echo( $quantityValue->getUnit() );
based on FfJ3r
Output for 7.2.0 - 7.3.1
Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/RJJ3P on line 17 Warning: assert(): Assertion "$this->m_unitin" failed in /in/RJJ3P on line 17 K
Output for 5.5.0 - 7.1.25
Warning: assert(): Assertion "$this->m_unitin" failed in /in/RJJ3P on line 17 K