3v4l.org

run code in 300+ PHP versions simultaneously
<?php $width = 300; $height = 150; $ratio = "2/1"; var_export( sscanf($ratio, '%d/%d') ); list($numerator, $denominator) = array_pad(sscanf($ratio, '%d/%d'), 2, 1); echo $numerator / $denominator == $width / $height ? 'true' : 'false';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RIA5t
function name:  (null)
number of ops:  33
compiled vars:  !0 = $width, !1 = $height, !2 = $ratio, !3 = $numerator, !4 = $denominator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 300
    4     1        ASSIGN                                                   !1, 150
    6     2        ASSIGN                                                   !2, '2%2F1'
    8     3        INIT_FCALL                                               'var_export'
          4        INIT_FCALL                                               'sscanf'
          5        SEND_VAR                                                 !2
          6        SEND_VAL                                                 '%25d%2F%25d'
          7        DO_ICALL                                         $8      
          8        SEND_VAR                                                 $8
          9        DO_ICALL                                                 
   10    10        INIT_FCALL                                               'array_pad'
         11        INIT_FCALL                                               'sscanf'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 '%25d%2F%25d'
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        SEND_VAL                                                 2
         17        SEND_VAL                                                 1
         18        DO_ICALL                                         $11     
         19        FETCH_LIST_R                                     $12     $11, 0
         20        ASSIGN                                                   !3, $12
         21        FETCH_LIST_R                                     $14     $11, 1
         22        ASSIGN                                                   !4, $14
         23        FREE                                                     $11
   12    24        DIV                                              ~16     !3, !4
         25        DIV                                              ~17     !0, !1
         26        IS_EQUAL                                                 ~16, ~17
         27      > JMPZ                                                     ~18, ->30
         28    >   QM_ASSIGN                                        ~19     'true'
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~19     'false'
         31    >   ECHO                                                     ~19
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.32 ms | 1396 KiB | 19 Q