3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = [ ['url' => 'https://www.example.com/', 'parent_url' => 'https://www.example.com/bleh/bleh.aspx'], ['url' => 'https://www.example2.com/', 'parent_url' => 'https://www.example2.com/blar.aspx'], 'not an array', ['url' => 'https://www.example.com/', 'parent_url' => 'https://www.example.com/bla/bla.aspx'], ]; $urls_uniq = ['https://www.example.com/', 'https://www.example.com/go/173.aspx']; var_export( array_uintersect( $urls, $urls_uniq, function($a, $b) { echo json_encode($a) . ' VS ' . json_encode($b) . "\n"; // return ($a['url'] ?? null) === $b ? 0 : 1; // this doesn't work. // return ($a['url'] ?? $a) === ($b['url'] ?? $b) ? 0 : 1; // this doesn't work return strcmp($a['url'] ?? $a, $b['url'] ?? $b); // or return ($a['url'] ?? $a) <=> ($b['url'] ?? $b); } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mNJ7
function name:  (null)
number of ops:  12
compiled vars:  !0 = $urls, !1 = $urls_uniq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'var_export'
   13     3        INIT_FCALL                                               'array_uintersect'
   14     4        SEND_VAR                                                 !0
   15     5        SEND_VAR                                                 !1
   16     6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   22     7        SEND_VAL                                                 ~4
   13     8        DO_ICALL                                         $5      
   22     9        SEND_VAR                                                 $5
   12    10        DO_ICALL                                                 
   24    11      > 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/3mNJ7
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL                                               'json_encode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        CONCAT                                           ~3      $2, '+VS+'
          6        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      ~3, $4
         10        CONCAT                                           ~6      ~5, '%0A'
         11        ECHO                                                     ~6
   20    12        INIT_FCALL                                               'strcmp'
         13        FETCH_DIM_IS                                     ~7      !0, 'url'
         14        COALESCE                                         ~8      ~7
         15        QM_ASSIGN                                        ~8      !0
         16        SEND_VAL                                                 ~8
         17        FETCH_DIM_IS                                     ~9      !1, 'url'
         18        COALESCE                                         ~10     ~9
         19        QM_ASSIGN                                        ~10     !1
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                         $11     
         22      > RETURN                                                   $11
   22    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
262.47 ms | 1014 KiB | 17 Q