3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class Word { private $word; public function __construct(string $word) { $this->word = $word; } public function reverse(): self { return new self(strrev($this->word)); } public function __toString() { return $this->word; } } $word = new Word('potato'); echo $word->reverse();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ONklH
function name:  (null)
number of ops:  9
compiled vars:  !0 = $word
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'word'
   23     1        NEW                                                  $1      'Word'
          2        SEND_VAL_EX                                                  'potato'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $1
   25     5        INIT_METHOD_CALL                                             !0, 'reverse'
          6        DO_FCALL                                          0  $4      
          7        ECHO                                                         $4
          8      > RETURN                                                       1

Class Word:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ONklH
function name:  __construct
number of ops:  4
compiled vars:  !0 = $word
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    9     1        ASSIGN_OBJ                                                   'word'
          2        OP_DATA                                                      !0
   10     3      > RETURN                                                       null

End of function __construct

Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ONklH
function name:  reverse
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   NEW                              self                $0      
          1        INIT_FCALL                                                   'strrev'
          2        FETCH_OBJ_R                                          ~1      'word'
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5        SEND_VAR_NO_REF_EX                                           $2
          6        DO_FCALL                                          0          
          7        VERIFY_RETURN_TYPE                                           $0
          8      > RETURN                                                       $0
   15     9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       null

End of function reverse

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ONklH
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                          ~0      'word'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   20     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function __tostring

End of class Word.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.33 ms | 2398 KiB | 14 Q