3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LuckyNumbers { public function sumUp(array $digitsOfNumber1, array $digitsOfNumber2): int { $convNum1 = (int) implode($digitsOfNumber1); $convNum2 = (int) implode($digitsOfNumber2); return $convNum1+ $convNum2; throw new \BadFunctionCallException("Implement the function"); } public function isPalindrome(int $number): bool { // Reversing steps:- $numberString = (string) $number; $reverseNumberString = strrev($numberString); $reverseNumber = (int) $reverseNumberString; return $number == $reverseNumber; throw new \BadFunctionCallException("Implement the function"); } public function validate(string $input): string { if ($input <= 0) { echo "Must be a whole number larger than 0"; } if ($input == '') { echo "Required field"; } } } $lucky_numbers = new LuckyNumbers(); $lucky_numbers->validate('123');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sa7qN
function name:  (null)
number of ops:  7
compiled vars:  !0 = $lucky_numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $1      'LuckyNumbers'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   40     3        INIT_METHOD_CALL                                         !0, 'validate'
          4        SEND_VAL_EX                                              '123'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class LuckyNumbers:
Function sumup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sa7qN
function name:  sumUp
number of ops:  21
compiled vars:  !0 = $digitsOfNumber1, !1 = $digitsOfNumber2, !2 = $convNum1, !3 = $convNum2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'implode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        CAST                                          4  ~5      $4
          6        ASSIGN                                                   !2, ~5
    8     7        INIT_FCALL                                               'implode'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        CAST                                          4  ~8      $7
         11        ASSIGN                                                   !3, ~8
   10    12        ADD                                              ~10     !2, !3
         13        VERIFY_RETURN_TYPE                                       ~10
         14      > RETURN                                                   ~10
   12    15*       NEW                                              $11     'BadFunctionCallException'
         16*       SEND_VAL_EX                                              'Implement+the+function'
         17*       DO_FCALL                                      0          
         18*       THROW                                         0          $11
   13    19*       VERIFY_RETURN_TYPE                                       
         20*     > RETURN                                                   null

End of function sumup

Function ispalindrome:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sa7qN
function name:  isPalindrome
number of ops:  18
compiled vars:  !0 = $number, !1 = $numberString, !2 = $reverseNumberString, !3 = $reverseNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   18     1        CAST                                          6  ~4      !0
          2        ASSIGN                                                   !1, ~4
   19     3        INIT_FCALL                                               'strrev'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   20     7        CAST                                          4  ~8      !2
          8        ASSIGN                                                   !3, ~8
   22     9        IS_EQUAL                                         ~10     !0, !3
         10        VERIFY_RETURN_TYPE                                       ~10
         11      > RETURN                                                   ~10
   24    12*       NEW                                              $11     'BadFunctionCallException'
         13*       SEND_VAL_EX                                              'Implement+the+function'
         14*       DO_FCALL                                      0          
         15*       THROW                                         0          $11
   25    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function ispalindrome

Function validate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
Branch analysis from position: 4
filename:       /in/sa7qN
function name:  validate
number of ops:  9
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        IS_SMALLER_OR_EQUAL                                      !0, 0
          2      > JMPZ                                                     ~1, ->4
   30     3    >   ECHO                                                     'Must+be+a+whole+number+larger+than+0'
   33     4    >   IS_EQUAL                                                 !0, ''
          5      > JMPZ                                                     ~2, ->7
   34     6    >   ECHO                                                     'Required+field'
   36     7    >   VERIFY_RETURN_TYPE                                       
          8      > RETURN                                                   null

End of function validate

End of class LuckyNumbers.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.16 ms | 1442 KiB | 15 Q