3v4l.org

run code in 300+ PHP versions simultaneously
// PHP 5.0 or later: $array = []; var_dump(empty($array)); // outputs bool(true) $array = new ArrayObject(); var_dump(empty($array)); // outputs bool(false) // why don't these both produce the same output?<?php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cAZL6
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%2F%2F+PHP+5.0+or+later%3A%0A%24array+%3D+%5B%5D%3B%0Avar_dump%28empty%28%24array%29%29%3B++++++++%2F%2F+outputs+bool%28true%29+%0A%24array+%3D+new+ArrayObject%28%29%3B%0Avar_dump%28empty%28%24array%29%29%3B++++++++%2F%2F+outputs+bool%28false%29%0A%2F%2F+why+don%27t+these+both+produce+the+same+output%3F'
    6     1      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.96 ms | 1383 KiB | 13 Q