3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ["a" => "green", "b" => "brown", "c" => "blue", 0 => "red"]; $array2 = ["a" => "GREEN", "B" => "brown", 0 => "yellow", 1 => "red", "c" => "blue"]; var_export( array_uintersect_assoc( $array1, $array2, function ($a, $b) { //var_export([$a, $b, str_contains($a, $b), (bool)str_contains($a, $b), (int)(bool)str_contains($a, $b)]); //echo "\n"; return str_contains($a, $b); } ) ); echo "\n---\n"; var_export( array_udiff_assoc( $array1, $array2, function ($a, $b) { //var_export([$a, $b, str_contains($a, $b), (bool)str_contains($a, $b), (int)(bool)str_contains($a, $b)]); //echo "\n"; return str_contains($a, $b); } ) ); echo "\n---\n"; var_export( array_uintersect_assoc( $array1, $array2, function ($a, $b) { return str_contains($a, $b) ? 0 : 1; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rt4Jq
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'var_export'
    7     3        INIT_FCALL                                               'array_uintersect_assoc'
    8     4        SEND_VAR                                                 !0
    9     5        SEND_VAR                                                 !1
   10     6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   14     7        SEND_VAL                                                 ~4
    7     8        DO_ICALL                                         $5      
   14     9        SEND_VAR                                                 $5
    6    10        DO_ICALL                                                 
   18    11        ECHO                                                     '%0A---%0A'
   20    12        INIT_FCALL                                               'var_export'
   21    13        INIT_FCALL                                               'array_udiff_assoc'
   22    14        SEND_VAR                                                 !0
   23    15        SEND_VAR                                                 !1
   24    16        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
   28    17        SEND_VAL                                                 ~7
   21    18        DO_ICALL                                         $8      
   28    19        SEND_VAR                                                 $8
   20    20        DO_ICALL                                                 
   32    21        ECHO                                                     '%0A---%0A'
   34    22        INIT_FCALL                                               'var_export'
   35    23        INIT_FCALL                                               'array_uintersect_assoc'
   36    24        SEND_VAR                                                 !0
   37    25        SEND_VAR                                                 !1
   38    26        DECLARE_LAMBDA_FUNCTION                          ~10     [2]
   40    27        SEND_VAL                                                 ~10
   35    28        DO_ICALL                                         $11     
   40    29        SEND_VAR                                                 $11
   34    30        DO_ICALL                                                 
   42    31      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rt4Jq
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        INIT_FCALL                                               'str_contains'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   14     7*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rt4Jq
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        INIT_FCALL                                               'str_contains'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   28     7*     > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rt4Jq
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   39     2        INIT_FCALL                                               'str_contains'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->9
          7    >   QM_ASSIGN                                        ~3      0
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~3      1
         10    > > RETURN                                                   ~3
   40    11*     > RETURN                                                   null

End of Dynamic Function 2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.11 ms | 1006 KiB | 17 Q