3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Phrase { public function __construct($text, $arguments = array()) { $this->_text = (string)$text; $this->_arguments = $arguments; } public function __toString() { return $this->render($this->_text, $this->_arguments); } public function render($text, $arguments) { if ($arguments) { $placeholders = array(); for ($i = 1, $size = count($arguments); $i <= $size; $i++) { $placeholders[] = "%$i"; } $text = str_replace($placeholders, $arguments, $text); } return $text; } } function __(){ $argc = func_get_args(); return new Phrase(array_shift($argc), $argc); } echo __('sdgsa gsag sg %1 gas g%2 w4', 1111,222) ,'<br>'; echo __('sdgsa gsag sg %1 gas g%2 w4', 1111) ,'<br>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QibN
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'phrase'
   38     1        INIT_FCALL                                               '__'
          2        SEND_VAL                                                 'sdgsa+gsag+sg+%251+gas+g%252+w4'
          3        SEND_VAL                                                 1111
          4        SEND_VAL                                                 222
          5        DO_FCALL                                      0  $0      
          6        ECHO                                                     $0
          7        ECHO                                                     '%3Cbr%3E'
   39     8        INIT_FCALL                                               '__'
          9        SEND_VAL                                                 'sdgsa+gsag+sg+%251+gas+g%252+w4'
         10        SEND_VAL                                                 1111
         11        DO_FCALL                                      0  $1      
         12        ECHO                                                     $1
         13        ECHO                                                     '%3Cbr%3E'
         14      > RETURN                                                   1

Function __:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QibN
function name:  __
number of ops:  11
compiled vars:  !0 = $argc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FUNC_GET_ARGS                                    ~1      
          1        ASSIGN                                                   !0, ~1
   34     2        NEW                                              $3      'Phrase'
          3        INIT_FCALL                                               'array_shift'
          4        SEND_REF                                                 !0
          5        DO_ICALL                                         $4      
          6        SEND_VAR_NO_REF_EX                                       $4
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9      > RETURN                                                   $3
   36    10*     > RETURN                                                   null

End of function __

Class Phrase:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QibN
function name:  __construct
number of ops:  8
compiled vars:  !0 = $text, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    7     2        CAST                                          6  ~3      !0
          3        ASSIGN_OBJ                                               '_text'
          4        OP_DATA                                                  ~3
    8     5        ASSIGN_OBJ                                               '_arguments'
          6        OP_DATA                                                  !1
    9     7      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QibN
function name:  __toString
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                         'render'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      '_text'
          3        SEND_FUNC_ARG                                            $0
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $1      '_arguments'
          6        SEND_FUNC_ARG                                            $1
          7        DO_FCALL                                      0  $2      
          8        VERIFY_RETURN_TYPE                                       $2
          9      > RETURN                                                   $2
   16    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function __tostring

Function render:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 8
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 8
Branch analysis from position: 15
Branch analysis from position: 8
Branch analysis from position: 21
filename:       /in/5QibN
function name:  render
number of ops:  23
compiled vars:  !0 = $text, !1 = $arguments, !2 = $placeholders, !3 = $i, !4 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2      > JMPZ                                                     !1, ->21
   20     3    >   ASSIGN                                                   !2, <array>
   21     4        ASSIGN                                                   !3, 1
          5        COUNT                                            ~7      !1
          6        ASSIGN                                                   !4, ~7
          7      > JMP                                                      ->13
   22     8    >   NOP                                                      
          9        FAST_CONCAT                                      ~10     '%25', !3
         10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  ~10
   21    12        PRE_INC                                                  !3
         13    >   IS_SMALLER_OR_EQUAL                                      !3, !4
         14      > JMPNZ                                                    ~12, ->8
   24    15    >   INIT_FCALL                                               'str_replace'
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !0, $13
   26    21    > > RETURN                                                   !0
   27    22*     > RETURN                                                   null

End of function render

End of class Phrase.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.92 ms | 1406 KiB | 19 Q