3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Surprise surprise! When the 2nd array param of array_diff() contains an elemant with value false, // the result will no longer contain null values. function myIsset($value) { return isset($value); } $arrayWithTrueValue = array( 'null1' => null, 'null2' => null, 'bool' => true, ); $filteredArray = array_filter($arrayWithTrueValue, 'myIsset'); echo "arrayWithTrueValue has three elements..\n"; var_dump($arrayWithTrueValue, $filteredArray, array_diff($arrayWithTrueValue, $filteredArray)); $arrayWithFalseValue = $arrayWithTrueValue; $arrayWithFalseValue['bool'] = false; $filteredArrayWithOnlyFalse = array_filter($arrayWithFalseValue, 'myIsset'); var_dump($arrayWithFalseValue, $filteredArrayWithOnlyFalse, array_diff($arrayWithFalseValue, $filteredArrayWithOnlyFalse));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ipPDL
function name:  (null)
number of ops:  34
compiled vars:  !0 = $arrayWithTrueValue, !1 = $filteredArray, !2 = $arrayWithFalseValue, !3 = $filteredArrayWithOnlyFalse
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'myIsset'
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   19     6        ECHO                                                     'arrayWithTrueValue+has+three+elements..%0A'
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        INIT_FCALL                                               'array_diff'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
   22    16        ASSIGN                                                   !2, !0
   23    17        ASSIGN_DIM                                               !2, 'bool'
         18        OP_DATA                                                  <false>
   25    19        INIT_FCALL                                               'array_filter'
         20        SEND_VAR                                                 !2
         21        SEND_VAL                                                 'myIsset'
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !3, $11
   27    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !2
         26        SEND_VAR                                                 !3
         27        INIT_FCALL                                               'array_diff'
         28        SEND_VAR                                                 !2
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $13     
         31        SEND_VAR                                                 $13
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function myisset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ipPDL
function name:  myIsset
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2      > RETURN                                                   ~1
    9     3*     > RETURN                                                   null

End of function myisset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.11 ms | 1396 KiB | 19 Q