3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ordinal($cdnl){ $test_c = abs($cdnl) % 10; $ext = ((abs($cdnl) %100 < 21 && abs($cdnl) %100 > 4) ? 'th' : (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th')); return $cdnl.$ext; } for($i=1;$i<100;$i++){ echo ordinal($i).'<br>'; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
Branch analysis from position: 2
filename:       /in/WUdgA
function name:  (null)
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->8
   10     2    >   INIT_FCALL                                               'ordinal'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        CONCAT                                           ~3      $2, '%3Cbr%3E'
          6        ECHO                                                     ~3
    9     7        PRE_INC                                                  !0
          8    >   IS_SMALLER                                               !0, 100
          9      > JMPNZ                                                    ~5, ->2
   12    10    > > RETURN                                                   1

Function ordinal:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 40
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/WUdgA
function name:  ordinal
number of ops:  46
compiled vars:  !0 = $cdnl, !1 = $test_c, !2 = $ext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'abs'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        MOD                                              ~4      $3, 10
          5        ASSIGN                                                   !1, ~4
    4     6        INIT_FCALL                                               'abs'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        MOD                                              ~7      $6, 100
         10        IS_SMALLER                                       ~8      ~7, 21
         11      > JMPZ_EX                                          ~8      ~8, ->18
         12    >   INIT_FCALL                                               'abs'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        MOD                                              ~10     $9, 100
         16        IS_SMALLER                                       ~11     4, ~10
         17        BOOL                                             ~8      ~11
         18    > > JMPZ                                                     ~8, ->21
         19    >   QM_ASSIGN                                        ~12     'th'
         20      > JMP                                                      ->42
    5    21    >   IS_SMALLER                                               !1, 4
         22      > JMPZ                                                     ~13, ->40
         23    >   IS_SMALLER                                               !1, 3
         24      > JMPZ                                                     ~14, ->37
         25    >   IS_SMALLER                                               !1, 2
         26      > JMPZ                                                     ~15, ->34
         27    >   IS_SMALLER                                               !1, 1
         28      > JMPZ                                                     ~16, ->31
    6    29    >   QM_ASSIGN                                        ~17     'th'
         30      > JMP                                                      ->32
         31    >   QM_ASSIGN                                        ~17     'st'
         32    >   QM_ASSIGN                                        ~18     ~17
         33      > JMP                                                      ->35
         34    >   QM_ASSIGN                                        ~18     'nd'
         35    >   QM_ASSIGN                                        ~19     ~18
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~19     'rd'
         38    >   QM_ASSIGN                                        ~20     ~19
         39      > JMP                                                      ->41
         40    >   QM_ASSIGN                                        ~20     'th'
         41    >   QM_ASSIGN                                        ~12     ~20
    4    42    >   ASSIGN                                                   !2, ~12
    7    43        CONCAT                                           ~22     !0, !2
         44      > RETURN                                                   ~22
    8    45*     > RETURN                                                   null

End of function ordinal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.4 ms | 1394 KiB | 16 Q