3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileSize = new fileSize(); $minHeight = 180; $minWidth = 180; $shortestSide = 180; if ($fileSize->getWidth() > $fileSize->getHeight()) { if ($fileSize->getHeight() > $minHeight) { $width = round($fileSize->getWidth() * ($minHeight / $fileSize->getHeight())); $height = $shortestSide; } } elseif ($fileSize->getHeight() > $fileSize->getWidth()) { $height = round($fileSize->getHeight() * ($minWidth / $fileSize->getWidth())); $width = $shortestSide; } elseif ($height === $width) { $height = $minHeight; $width = $minWidth; } return ['width' => $width, 'height' => $height]; class fileSize { public function getWidth() { return 1200; } public function getHeight() { return 630; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 46
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
filename:       /in/e71lg
function name:  (null)
number of ops:  54
compiled vars:  !0 = $fileSize, !1 = $minHeight, !2 = $minWidth, !3 = $shortestSide, !4 = $width, !5 = $height
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $6      'fileSize'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
    4     3        ASSIGN                                                   !1, 180
    5     4        ASSIGN                                                   !2, 180
    6     5        ASSIGN                                                   !3, 180
    8     6        INIT_METHOD_CALL                                         !0, 'getWidth'
          7        DO_FCALL                                      0  $12     
          8        INIT_METHOD_CALL                                         !0, 'getHeight'
          9        DO_FCALL                                      0  $13     
         10        IS_SMALLER                                               $13, $12
         11      > JMPZ                                                     ~14, ->28
    9    12    >   INIT_METHOD_CALL                                         !0, 'getHeight'
         13        DO_FCALL                                      0  $15     
         14        IS_SMALLER                                               !1, $15
         15      > JMPZ                                                     ~16, ->27
   10    16    >   INIT_FCALL                                               'round'
         17        INIT_METHOD_CALL                                         !0, 'getWidth'
         18        DO_FCALL                                      0  $17     
         19        INIT_METHOD_CALL                                         !0, 'getHeight'
         20        DO_FCALL                                      0  $18     
         21        DIV                                              ~19     !1, $18
         22        MUL                                              ~20     $17, ~19
         23        SEND_VAL                                                 ~20
         24        DO_ICALL                                         $21     
         25        ASSIGN                                                   !4, $21
   11    26        ASSIGN                                                   !5, !3
         27    > > JMP                                                      ->50
   13    28    >   INIT_METHOD_CALL                                         !0, 'getHeight'
         29        DO_FCALL                                      0  $24     
         30        INIT_METHOD_CALL                                         !0, 'getWidth'
         31        DO_FCALL                                      0  $25     
         32        IS_SMALLER                                               $25, $24
         33      > JMPZ                                                     ~26, ->46
   14    34    >   INIT_FCALL                                               'round'
         35        INIT_METHOD_CALL                                         !0, 'getHeight'
         36        DO_FCALL                                      0  $27     
         37        INIT_METHOD_CALL                                         !0, 'getWidth'
         38        DO_FCALL                                      0  $28     
         39        DIV                                              ~29     !2, $28
         40        MUL                                              ~30     $27, ~29
         41        SEND_VAL                                                 ~30
         42        DO_ICALL                                         $31     
         43        ASSIGN                                                   !5, $31
   15    44        ASSIGN                                                   !4, !3
         45      > JMP                                                      ->50
   16    46    >   IS_IDENTICAL                                             !5, !4
         47      > JMPZ                                                     ~34, ->50
   17    48    >   ASSIGN                                                   !5, !1
   18    49        ASSIGN                                                   !4, !2
   21    50    >   INIT_ARRAY                                       ~37     !4, 'width'
         51        ADD_ARRAY_ELEMENT                                ~37     !5, 'height'
         52      > RETURN                                                   ~37
   34    53*     > RETURN                                                   1

Class fileSize:
Function getwidth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e71lg
function name:  getWidth
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   1200
   28     1*     > RETURN                                                   null

End of function getwidth

Function getheight:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e71lg
function name:  getHeight
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E > > RETURN                                                   630
   33     1*     > RETURN                                                   null

End of function getheight

End of class fileSize.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.06 ms | 1400 KiB | 15 Q