3v4l.org

run code in 300+ PHP versions simultaneously
<?php $imagee = true; $width = 1; $height = 10; function fit($maxwidth = false, $maxheight = false) { if (!$imagee) return false; # First must find which direction will be the limiting factor. # E.g. a short image in a tall frame will be limited # by width while a tall image in a short frame will be # limited by height. if ($maxwidth && $maxheight) { $frameratio = $maxheight/$maxwidth; } if ($width == 0) return false; // Prevent divide by zero error. $imageratio = $height/$width; # If the fit frameratio is less than the imageratio then # the height constrains if ( (($frameratio > 0) && ($frameratio < $imageratio)) || !$maxwidth) { // Height constrains // $newwidth = $maxheight / $imageratio; if ($newwidth < 1) $newwidth = 1; $this->resize($newwidth,$maxheight); } else { // Width constrains // $newheight = $maxwidth * $imageratio; if ($newheight < 1) $newheight = 1; $this->resize($maxwidth,$newheight); } } fit();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cm8uU
function name:  (null)
number of ops:  6
compiled vars:  !0 = $imagee, !1 = $width, !2 = $height
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <true>
    4     1        ASSIGN                                                   !1, 1
    5     2        ASSIGN                                                   !2, 10
   44     3        INIT_FCALL                                               'fit'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function fit:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 34
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 39
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 22
Branch analysis from position: 19
Branch analysis from position: 10
Branch analysis from position: 7
filename:       /in/Cm8uU
function name:  fit
number of ops:  45
compiled vars:  !0 = $maxwidth, !1 = $maxheight, !2 = $imagee, !3 = $frameratio, !4 = $width, !5 = $imageratio, !6 = $height, !7 = $newwidth, !8 = $newheight
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <false>
          1        RECV_INIT                                        !1      <false>
    9     2        BOOL_NOT                                         ~9      !2
          3      > JMPZ                                                     ~9, ->5
          4    > > RETURN                                                   <false>
   16     5    > > JMPZ_EX                                          ~10     !0, ->7
          6    >   BOOL                                             ~10     !1
          7    > > JMPZ                                                     ~10, ->10
   17     8    >   DIV                                              ~11     !1, !0
          9        ASSIGN                                                   !3, ~11
   20    10    >   IS_EQUAL                                                 !4, 0
         11      > JMPZ                                                     ~13, ->13
         12    > > RETURN                                                   <false>
   21    13    >   DIV                                              ~14     !6, !4
         14        ASSIGN                                                   !5, ~14
   26    15        IS_SMALLER                                       ~16     0, !3
         16      > JMPZ_EX                                          ~16     ~16, ->19
         17    >   IS_SMALLER                                       ~17     !3, !5
         18        BOOL                                             ~16     ~17
         19    > > JMPNZ_EX                                         ~16     ~16, ->22
         20    >   BOOL_NOT                                         ~18     !0
         21        BOOL                                             ~16     ~18
         22    > > JMPZ                                                     ~16, ->34
   29    23    >   DIV                                              ~19     !1, !5
         24        ASSIGN                                                   !7, ~19
   30    25        IS_SMALLER                                               !7, 1
         26      > JMPZ                                                     ~21, ->28
         27    >   ASSIGN                                                   !7, 1
   31    28    >   FETCH_THIS                                       $23     
         29        INIT_METHOD_CALL                                         $23, 'resize'
         30        SEND_VAR_EX                                              !7
         31        SEND_VAR_EX                                              !1
         32        DO_FCALL                                      0          
         33      > JMP                                                      ->44
   36    34    >   MUL                                              ~25     !0, !5
         35        ASSIGN                                                   !8, ~25
   37    36        IS_SMALLER                                               !8, 1
         37      > JMPZ                                                     ~27, ->39
         38    >   ASSIGN                                                   !8, 1
   38    39    >   FETCH_THIS                                       $29     
         40        INIT_METHOD_CALL                                         $29, 'resize'
         41        SEND_VAR_EX                                              !0
         42        SEND_VAR_EX                                              !8
         43        DO_FCALL                                      0          
   41    44    > > RETURN                                                   null

End of function fit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.31 ms | 1403 KiB | 14 Q