3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $liParams = array('class'=>'cart'); $liParamsTxt=''; if($_link->getIsFirst()) $liParams['class'][]='first'; if($_link->getIsLast()) $liParams['class'][]='last'; if (!empty($liParams) && is_array($liParams)) { foreach ($liParams as $key=>$value) { $liParamsTxt .= ' '.$key.'="'.addslashes($value).'"'; } } echo $liParamsTxt;
based on 67iGj
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: _link in /in/ODZ7H on line 4 Fatal error: Uncaught Error: Call to a member function getIsFirst() on null in /in/ODZ7H:4 Stack trace: #0 {main} thrown in /in/ODZ7H on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: _link in /in/ODZ7H on line 4 Fatal error: Uncaught Error: Call to a member function getIsFirst() on unknown in /in/ODZ7H:4 Stack trace: #0 {main} thrown in /in/ODZ7H on line 4
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: _link in /in/ODZ7H on line 4 Fatal error: Call to a member function getIsFirst() on null in /in/ODZ7H on line 4
Process exited with code 255.
Output for 5.3.19 - 5.5.35
Notice: Undefined variable: _link in /in/ODZ7H on line 4 Fatal error: Call to a member function getIsFirst() on a non-object in /in/ODZ7H on line 4
Process exited with code 255.