3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Interview code review assignment class Greeter { private static $sStart; private static $sEnd; /** * Sets the greeter's sentence * @param string $sentenceStart * @param string $sentenceEnd */ public static function setSentence(string $sentenceStart, string $sentenceEnd) { self::$sStart = $sentenceStart; self::$sEnd = $sentenceEnd; } public static function greet($name) { print self::$sStart . $name . self::$sEnd; } } Greeter::setSentence("Hello ", "!\n"); Greeter::greet("John"); // Outputs: "Hello John!\n" Greeter::setSentence("Have a nice day, ", "...\n"); Greeter::greet("Peter"); // Outputs: "Have a nice day, Peter...\n"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDnkY
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                  'Greeter', 'setSentence'
          1        SEND_VAL                                                 'Hello+'
          2        SEND_VAL                                                 '%21%0A'
          3        DO_FCALL                                      0          
   28     4        INIT_STATIC_METHOD_CALL                                  'Greeter', 'greet'
          5        SEND_VAL                                                 'John'
          6        DO_FCALL                                      0          
   31     7        INIT_STATIC_METHOD_CALL                                  'Greeter', 'setSentence'
          8        SEND_VAL                                                 'Have+a+nice+day%2C+'
          9        SEND_VAL                                                 '...%0A'
         10        DO_FCALL                                      0          
   32    11        INIT_STATIC_METHOD_CALL                                  'Greeter', 'greet'
         12        SEND_VAL                                                 'Peter'
         13        DO_FCALL                                      0          
   33    14      > RETURN                                                   1

Class Greeter:
Function setsentence:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDnkY
function name:  setSentence
number of ops:  7
compiled vars:  !0 = $sentenceStart, !1 = $sentenceEnd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        ASSIGN_STATIC_PROP                                       'sStart'
          3        OP_DATA                                                  !0
   18     4        ASSIGN_STATIC_PROP                                       'sEnd'
          5        OP_DATA                                                  !1
   19     6      > RETURN                                                   null

End of function setsentence

Function greet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDnkY
function name:  greet
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        FETCH_STATIC_PROP_R          unknown             ~1      'sStart'
          2        CONCAT                                           ~2      ~1, !0
          3        FETCH_STATIC_PROP_R          unknown             ~3      'sEnd'
          4        CONCAT                                           ~4      ~2, ~3
          5        ECHO                                                     ~4
   24     6      > RETURN                                                   null

End of function greet

End of class Greeter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.62 ms | 1395 KiB | 13 Q