3v4l.org

run code in 300+ PHP versions simultaneously
<?php function distance($vect1, $vect2) { if (!is_array($vect1) || !is_array($vect2)) { return NULL; } if (count($vect1) != count($vect2)) { return NULL; } for ($i=0; $i<count($vect1); $i++) { $c1 = $vect1[$i]; $c2 = $vect2[$i]; $d = 0.0; if (!is_numeric($c1)) { trigger_error("Coordinate $i in vector 1 is not a number, using zero", E_USER_WARNING); $c1 = 0.0; } if (!is_numeric($c2)) { trigger_error("Coordinate $i in vector 2 is not a number, using zero", E_USER_WARNING); $c2 = 0.0; } $d += $c2*$c2 - $c1*$c1; return $d; echo sqrt($d); } return $d; } // variabile non definita, genera un warning $t = I_AM_NOT_DEFINED; // definisce dei vettori $a = array(2, 3, "foo"); $b = array(5.5, 4.3); $c = array(1, 3); // genera un errore utente distance($c, $b) . "\n"; // un'altro errore utente distance($b, "i am not an array") . "\n"; // genera un warning distance($a, $b) . "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hMA5o
function name:  (null)
number of ops:  24
compiled vars:  !0 = $t, !1 = $a, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   FETCH_CONSTANT                                   ~4      'I_AM_NOT_DEFINED'
          1        ASSIGN                                                   !0, ~4
   41     2        ASSIGN                                                   !1, <array>
   42     3        ASSIGN                                                   !2, <array>
   43     4        ASSIGN                                                   !3, <array>
   46     5        INIT_FCALL                                               'distance'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0  $9      
          9        CONCAT                                           ~10     $9, '%0A'
         10        FREE                                                     ~10
   49    11        INIT_FCALL                                               'distance'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 'i+am+not+an+array'
         14        DO_FCALL                                      0  $11     
         15        CONCAT                                           ~12     $11, '%0A'
         16        FREE                                                     ~12
   52    17        INIT_FCALL                                               'distance'
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !2
         20        DO_FCALL                                      0  $13     
         21        CONCAT                                           ~14     $13, '%0A'
         22        FREE                                                     ~14
   54    23      > RETURN                                                   1

Function distance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 17
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 48
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
Branch analysis from position: 35
Branch analysis from position: 8
filename:       /in/hMA5o
function name:  distance
number of ops:  63
compiled vars:  !0 = $vect1, !1 = $vect2, !2 = $i, !3 = $c1, !4 = $c2, !5 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        TYPE_CHECK                                  128  ~6      !0
          3        BOOL_NOT                                         ~7      ~6
          4      > JMPNZ_EX                                         ~7      ~7, ->8
          5    >   TYPE_CHECK                                  128  ~8      !1
          6        BOOL_NOT                                         ~9      ~8
          7        BOOL                                             ~7      ~9
          8    > > JMPZ                                                     ~7, ->10
    7     9    > > RETURN                                                   null
   10    10    >   COUNT                                            ~10     !0
         11        COUNT                                            ~11     !1
         12        IS_NOT_EQUAL                                             ~10, ~11
         13      > JMPZ                                                     ~12, ->15
   12    14    > > RETURN                                                   null
   15    15    >   ASSIGN                                                   !2, 0
         16      > JMP                                                      ->58
   16    17    >   FETCH_DIM_R                                      ~14     !0, !2
         18        ASSIGN                                                   !3, ~14
         19        FETCH_DIM_R                                      ~16     !1, !2
         20        ASSIGN                                                   !4, ~16
   17    21        ASSIGN                                                   !5, 0
   18    22        INIT_FCALL                                               'is_numeric'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $19     
         25        BOOL_NOT                                         ~20     $19
         26      > JMPZ                                                     ~20, ->35
   19    27    >   INIT_FCALL                                               'trigger_error'
         28        ROPE_INIT                                     3  ~22     'Coordinate+'
         29        ROPE_ADD                                      1  ~22     ~22, !2
         30        ROPE_END                                      2  ~21     ~22, '+in+vector+1+is+not+a+number%2C+using+zero'
         31        SEND_VAL                                                 ~21
   20    32        SEND_VAL                                                 512
         33        DO_ICALL                                                 
   21    34        ASSIGN                                                   !3, 0
   23    35    >   INIT_FCALL                                               'is_numeric'
         36        SEND_VAR                                                 !4
         37        DO_ICALL                                         $26     
         38        BOOL_NOT                                         ~27     $26
         39      > JMPZ                                                     ~27, ->48
   24    40    >   INIT_FCALL                                               'trigger_error'
         41        ROPE_INIT                                     3  ~29     'Coordinate+'
         42        ROPE_ADD                                      1  ~29     ~29, !2
         43        ROPE_END                                      2  ~28     ~29, '+in+vector+2+is+not+a+number%2C+using+zero'
         44        SEND_VAL                                                 ~28
   25    45        SEND_VAL                                                 512
         46        DO_ICALL                                                 
   26    47        ASSIGN                                                   !4, 0
   28    48    >   MUL                                              ~33     !4, !4
         49        MUL                                              ~34     !3, !3
         50        SUB                                              ~35     ~33, ~34
         51        ASSIGN_OP                                     1          !5, ~35
   29    52      > RETURN                                                   !5
   30    53*       INIT_FCALL                                               'sqrt'
         54*       SEND_VAR                                                 !5
         55*       DO_ICALL                                         $37     
         56*       ECHO                                                     $37
   15    57*       PRE_INC                                                  !2
         58    >   COUNT                                            ~39     !0
         59        IS_SMALLER                                               !2, ~39
         60      > JMPNZ                                                    ~40, ->17
   32    61    > > RETURN                                                   !5
   33    62*     > RETURN                                                   null

End of function distance

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.93 ms | 1407 KiB | 22 Q