3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<script> function percentShow(a,b) { if(b==5){ alert(b); alert(document.getElementById('mydiv1')); document.getElementById('mydiv1').style.backgroundColor = 'blue'; document.getElementById('mydiv1').style.width = '50%'; } } </script> <?php echo '<script>window.onload=percentShow('."'".$this->commonmodel->percentCount(5)."'".',5);</script>';?>
Output for 7.0.0 - 7.1.0
<script> function percentShow(a,b) { if(b==5){ alert(b); alert(document.getElementById('mydiv1')); document.getElementById('mydiv1').style.backgroundColor = 'blue'; document.getElementById('mydiv1').style.width = '50%'; } } </script> Fatal error: Uncaught Error: Using $this when not in object context in /in/liTJj:17 Stack trace: #0 {main} thrown in /in/liTJj on line 17
Process exited with code 255.
Output for 5.0.0 - 5.6.28
<script> function percentShow(a,b) { if(b==5){ alert(b); alert(document.getElementById('mydiv1')); document.getElementById('mydiv1').style.backgroundColor = 'blue'; document.getElementById('mydiv1').style.width = '50%'; } } </script> Fatal error: Using $this when not in object context in /in/liTJj on line 17
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<script> function percentShow(a,b) { if(b==5){ alert(b); alert(document.getElementById('mydiv1')); document.getElementById('mydiv1').style.backgroundColor = 'blue'; document.getElementById('mydiv1').style.width = '50%'; } } </script> Fatal error: Call to a member function on a non-object in /in/liTJj on line 17
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<script> function percentShow(a,b) { if(b==5){ alert(b); alert(document.getElementById('mydiv1')); document.getElementById('mydiv1').style.backgroundColor = 'blue'; document.getElementById('mydiv1').style.width = '50%'; } } </script> Fatal error: Call to a member function on a non-object in /in/liTJj on line 17