3v4l.org

run code in 300+ PHP versions simultaneously
<?php function intdiv_2($a, $b){ return floor($a / $b); } function isBouncy($num) { if ($num < 100) { return false; } $ni = true; $nd = true; $lastDigit = $num % 10; $num = intdiv_2($num, 10); while($num != 0) { $digit = $num % 10; if ($digit > $lastDigit) { $nd = false; } else if ($digit < $lastDigit) { $ni = false; } $lastDigit = $digit; $num = intdiv_2($num, 10); } return !$ni && !$nd; } var_dump(isBouncy(0)); var_dump(isBouncy(10)); var_dump(isBouncy(345)); var_dump(isBouncy(321)); var_dump(isBouncy(384));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WV6Pa
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'isbouncy'
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   30     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'isbouncy'
          8        SEND_VAL                                                 10
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   31    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'isbouncy'
         14        SEND_VAL                                                 345
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   32    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'isbouncy'
         20        SEND_VAL                                                 321
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   33    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'isbouncy'
         26        SEND_VAL                                                 384
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function intdiv_2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WV6Pa
function name:  intdiv_2
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'floor'
          3        DIV                                              ~2      !0, !1
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6      > RETURN                                                   $3
    5     7*     > RETURN                                                   null

End of function intdiv_2

Function isbouncy:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
Branch analysis from position: 14
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
Branch analysis from position: 14
Branch analysis from position: 23
filename:       /in/WV6Pa
function name:  isBouncy
number of ops:  37
compiled vars:  !0 = $num, !1 = $ni, !2 = $nd, !3 = $lastDigit, !4 = $digit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        IS_SMALLER                                               !0, 100
          2      > JMPZ                                                     ~5, ->4
    9     3    > > RETURN                                                   <false>
   11     4    >   ASSIGN                                                   !1, <true>
   12     5        ASSIGN                                                   !2, <true>
   13     6        MOD                                              ~8      !0, 10
          7        ASSIGN                                                   !3, ~8
   14     8        INIT_FCALL                                               'intdiv_2'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 10
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !0, $10
   15    13      > JMP                                                      ->29
   16    14    >   MOD                                              ~12     !0, 10
         15        ASSIGN                                                   !4, ~12
   17    16        IS_SMALLER                                               !3, !4
         17      > JMPZ                                                     ~14, ->20
   18    18    >   ASSIGN                                                   !2, <false>
         19      > JMP                                                      ->23
   20    20    >   IS_SMALLER                                               !4, !3
         21      > JMPZ                                                     ~16, ->23
   21    22    >   ASSIGN                                                   !1, <false>
   23    23    >   ASSIGN                                                   !3, !4
   24    24        INIT_FCALL                                               'intdiv_2'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 10
         27        DO_FCALL                                      0  $19     
         28        ASSIGN                                                   !0, $19
   15    29    >   IS_NOT_EQUAL                                             !0, 0
         30      > JMPNZ                                                    ~21, ->14
   26    31    >   BOOL_NOT                                         ~22     !1
         32      > JMPZ_EX                                          ~22     ~22, ->35
         33    >   BOOL_NOT                                         ~23     !2
         34        BOOL                                             ~22     ~23
         35    > > RETURN                                                   ~22
   27    36*     > RETURN                                                   null

End of function isbouncy

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.16 ms | 1407 KiB | 24 Q