3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lat1 = 35.697959; $lat2 = 35.697959; $lon1 = 139.707085; $lon2 = 139.707085; $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); var_dump($dist); // returns 1 $dist = acos(min(max($dist,-1.0),1.0)); var_dump($dist); // returns NAN $x = 1; $x = acos($x); var_dump($x); // doesn't return NAN
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dlunK
function name:  (null)
number of ops:  68
compiled vars:  !0 = $lat1, !1 = $lat2, !2 = $lon1, !3 = $lon2, !4 = $theta, !5 = $dist, !6 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 35.698
    4     1        ASSIGN                                                   !1, 35.698
    5     2        ASSIGN                                                   !2, 139.707
    6     3        ASSIGN                                                   !3, 139.707
    7     4        SUB                                              ~11     !2, !3
          5        ASSIGN                                                   !4, ~11
    8     6        INIT_FCALL                                               'sin'
          7        INIT_FCALL                                               'deg2rad'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $13     
         10        SEND_VAR                                                 $13
         11        DO_ICALL                                         $14     
         12        INIT_FCALL                                               'sin'
         13        INIT_FCALL                                               'deg2rad'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $15     
         16        SEND_VAR                                                 $15
         17        DO_ICALL                                         $16     
         18        MUL                                              ~17     $14, $16
         19        INIT_FCALL                                               'cos'
         20        INIT_FCALL                                               'deg2rad'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $18     
         23        SEND_VAR                                                 $18
         24        DO_ICALL                                         $19     
         25        INIT_FCALL                                               'cos'
         26        INIT_FCALL                                               'deg2rad'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $20     
         29        SEND_VAR                                                 $20
         30        DO_ICALL                                         $21     
         31        MUL                                              ~22     $19, $21
         32        INIT_FCALL                                               'cos'
         33        INIT_FCALL                                               'deg2rad'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                         $23     
         36        SEND_VAR                                                 $23
         37        DO_ICALL                                         $24     
         38        MUL                                              ~25     $24, ~22
         39        ADD                                              ~26     ~17, ~25
         40        ASSIGN                                                   !5, ~26
    9    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !5
         43        DO_ICALL                                                 
   11    44        INIT_FCALL                                               'acos'
         45        INIT_FCALL                                               'min'
         46        INIT_FCALL                                               'max'
         47        SEND_VAR                                                 !5
         48        SEND_VAL                                                 -1
         49        DO_ICALL                                         $29     
         50        SEND_VAR                                                 $29
         51        SEND_VAL                                                 1
         52        DO_ICALL                                         $30     
         53        SEND_VAR                                                 $30
         54        DO_ICALL                                         $31     
         55        ASSIGN                                                   !5, $31
   12    56        INIT_FCALL                                               'var_dump'
         57        SEND_VAR                                                 !5
         58        DO_ICALL                                                 
   14    59        ASSIGN                                                   !6, 1
   15    60        INIT_FCALL                                               'acos'
         61        SEND_VAR                                                 !6
         62        DO_ICALL                                         $35     
         63        ASSIGN                                                   !6, $35
   16    64        INIT_FCALL                                               'var_dump'
         65        SEND_VAR                                                 !6
         66        DO_ICALL                                                 
         67      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
220.52 ms | 1404 KiB | 27 Q