3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function decodeText($texts) { if(is_array($texts)) { $encoded = array(); foreach($texts as $key => $text) { if (!is_array($text )) { $encoded[$key] = utf8_decode($text); } else { $this->decodeText($text); } } } else { $encoded = utf8_decode($text); } return $encoded; } $smth = array('test' => 'ääõölö', 'test2' => array('öüõü', 'dasd212äöäöä' )); $smth = decodeText($smth); var_dump($smth); var_dump(decodeText('köõöõüpõ'));
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/5DcHY:16 Stack trace: #0 /in/5DcHY(28): decodeText(Array) #1 {main} thrown in /in/5DcHY on line 16
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: this in /in/5DcHY on line 16 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function decodeText() on a non-object (null)' in /in/5DcHY:16 Stack trace: #0 /in/5DcHY(28): decodeText() #1 {main}
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Using $this when not in object context in /in/5DcHY on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Call to a member function on a non-object in /in/5DcHY on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to a member function on a non-object in /in/5DcHY on line 16