3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* Challenge 1: Modify Test::$secret before it's output. Rules:: 1. No use of Reflection API / runkit extension 2. No stopping execution before Test::run() 3. No Exceptions or PHP errors / warnings notices allowed Hints: 1. Caesar 2. Magic methods 3. Requires a new feature of PHP 5.4 */ class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // $v is some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here $test->callback = 'shiney'; // end editing here echo $test->run();
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/A27Vd
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  19     0  E >   NOP                                                      
  41     1        NEW                                              $2      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $2
  45     4        ASSIGN_OBJ                                               !0, 'callback'
         5        OP_DATA                                                  'shiney'
  49     6        INIT_METHOD_CALL                                         !0, 'run'
         7        DO_FCALL                                      0  $6      
         8        ECHO                                                     $6
         9      > RETURN                                                   1

Class Test:
Function run:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/A27Vd
function name:  run
number of ops:  7
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  27     0  E >   FETCH_OBJ_R                                      $0      'callback'
         1        INIT_USER_CALL                                0          'call_user_func', $0
         2        DO_FCALL                                      0          
  28     3        FETCH_OBJ_R                                      $2      'secret'
         4        CONCAT                                           ~3      $2, '%0A'
         5      > RETURN                                                   ~3
  29     6*     > RETURN                                                   null

End of function run

Function __set:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/A27Vd
function name:  __set
number of ops:  11
compiled vars:  !0 = $k, !1 = $v, !2 = $key, !3 = $value
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  31     0  E >   RECV                                             !0      
         1        RECV                                             !1      
  33     2        FETCH_DIM_R                                      $4      !1, !1
         3        FETCH_DIM_R                                      $5      !1, $4
         4        ASSIGN                                                   !2, $5
  34     5        INIT_DYNAMIC_CALL                                        !1
         6        DO_FCALL                                      0  $7      
         7        ASSIGN                                                   !3, $7
  35     8        ASSIGN_OBJ                                               !2
         9        OP_DATA                                                  !3
  36    10      > RETURN                                                   null

End of function __set

End of class Test.

Generated using Vulcan Logic Dumper, using php 7.1.0