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); } } // variabile non definita, genera un warning // definisce dei vettori $b = array(5.5, 4.3); $c = array(1, 3); // genera un errore utente var_dump(distance($c, $b)) ; // un'altro errore utente var_dump(distance($b, "i am not an array")) ; // genera un warning ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OcQs9
function name:  (null)
number of ops:  17
compiled vars:  !0 = $b, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   ASSIGN                                                   !0, <array>
   44     1        ASSIGN                                                   !1, <array>
   47     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'distance'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   50     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'distance'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'i+am+not+an+array'
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   55    16      > 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/OcQs9
function name:  distance
number of ops:  62
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
   33    61    > > RETURN                                                   null

End of function distance

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.63 ms | 1406 KiB | 23 Q