3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class MyFile { private $filename; private $mimeType; public function __construct($filename, $mimeType) { $this->filename = $filename; $this->mimeType = $mimeType; } public function getFilename() { return $this->filename; } public function getMimeType() { return $this->mimeType; } } $array1[] = new MyFile("peter.jpg", "image/jpg"); $array1[] = new MyFile("peter.jpg", "image/png"); $array1[] = new MyFile("michal.jpg", "image/jpg"); $array2[] = new MyFile("johan.jpg", "image/jpg"); $array2[] = new MyFile("peter.jpg", "image/jpg"); $diffArray = array_udiff($array1, $array2, 'compareFiles'); function compareFiles($a, $b) { if ($a->getFilename() < $b->getFilename()) { return -1; } elseif ($a->getFilename() > $b->getFilename()) { return 1; } else { return 0; } } var_dump($diffArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/53ntB
function name:  (null)
number of ops:  40
compiled vars:  !0 = $array1, !1 = $array2, !2 = $diffArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $4      'MyFile'
          1        SEND_VAL_EX                                              'peter.jpg'
          2        SEND_VAL_EX                                              'image%2Fjpg'
          3        DO_FCALL                                      0          
          4        ASSIGN_DIM                                               !0
          5        OP_DATA                                                  $4
   23     6        NEW                                              $7      'MyFile'
          7        SEND_VAL_EX                                              'peter.jpg'
          8        SEND_VAL_EX                                              'image%2Fpng'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $7
   24    12        NEW                                              $10     'MyFile'
         13        SEND_VAL_EX                                              'michal.jpg'
         14        SEND_VAL_EX                                              'image%2Fjpg'
         15        DO_FCALL                                      0          
         16        ASSIGN_DIM                                               !0
         17        OP_DATA                                                  $10
   27    18        NEW                                              $13     'MyFile'
         19        SEND_VAL_EX                                              'johan.jpg'
         20        SEND_VAL_EX                                              'image%2Fjpg'
         21        DO_FCALL                                      0          
         22        ASSIGN_DIM                                               !1
         23        OP_DATA                                                  $13
   28    24        NEW                                              $16     'MyFile'
         25        SEND_VAL_EX                                              'peter.jpg'
         26        SEND_VAL_EX                                              'image%2Fjpg'
         27        DO_FCALL                                      0          
         28        ASSIGN_DIM                                               !1
         29        OP_DATA                                                  $16
   30    30        INIT_FCALL                                               'array_udiff'
         31        SEND_VAR                                                 !0
         32        SEND_VAR                                                 !1
         33        SEND_VAL                                                 'compareFiles'
         34        DO_ICALL                                         $18     
         35        ASSIGN                                                   !2, $18
   43    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Function comparefiles:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/53ntB
function name:  compareFiles
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        INIT_METHOD_CALL                                         !0, 'getFilename'
          3        DO_FCALL                                      0  $2      
          4        INIT_METHOD_CALL                                         !1, 'getFilename'
          5        DO_FCALL                                      0  $3      
          6        IS_SMALLER                                               $2, $3
          7      > JMPZ                                                     ~4, ->10
   34     8    > > RETURN                                                   -1
          9*       JMP                                                      ->19
   35    10    >   INIT_METHOD_CALL                                         !0, 'getFilename'
         11        DO_FCALL                                      0  $5      
         12        INIT_METHOD_CALL                                         !1, 'getFilename'
         13        DO_FCALL                                      0  $6      
         14        IS_SMALLER                                               $6, $5
         15      > JMPZ                                                     ~7, ->18
   36    16    > > RETURN                                                   1
         17*       JMP                                                      ->19
   38    18    > > RETURN                                                   0
   41    19*     > RETURN                                                   null

End of function comparefiles

Class MyFile:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/53ntB
function name:  __construct
number of ops:  7
compiled vars:  !0 = $filename, !1 = $mimeType
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ASSIGN_OBJ                                               'filename'
          3        OP_DATA                                                  !0
   10     4        ASSIGN_OBJ                                               'mimeType'
          5        OP_DATA                                                  !1
   11     6      > RETURN                                                   null

End of function __construct

Function getfilename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/53ntB
function name:  getFilename
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'filename'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getfilename

Function getmimetype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/53ntB
function name:  getMimeType
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'mimeType'
          1      > RETURN                                                   ~0
   19     2*     > RETURN                                                   null

End of function getmimetype

End of class MyFile.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.87 ms | 1404 KiB | 17 Q