3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Contemplate { private static $views = array (); private static $data = array (); private static $content; private function output($buffer) { $search = array( '/\>[^\S ]+/s', //strip whitespaces after tags, except space '/[^\S ]+\</s', //strip whitespaces before tags, except space '/(\s)+/s', // shorten multiple whitespace sequences '/>(\s)+</', ); $replace = array( '>', '<', '\\1', '> <', ); return (preg_replace($search, $replace, $buffer)); } public static function compose($views, array $data = NULL) { /* * render and output page * @param * $views - array of pages to render * $data - array of inject data to pages */ if ($data) { self::$data = $data; } self::$views = $views; extract(self::$data); ob_start(); foreach (self::$views as $value) { require VIEW_PATH . $value . '.php'; } unset($value); self::$content = ob_get_clean(); echo self::output(self::$content); } }//end class
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cWBCu
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E > > RETURN                                                   1

Class Contemplate:
Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cWBCu
function name:  output
number of ops:  10
compiled vars:  !0 = $buffer, !1 = $search, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        ASSIGN                                                   !1, <array>
   17     2        ASSIGN                                                   !2, <array>
   23     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8      > RETURN                                                   $5
   24     9*     > RETURN                                                   null

End of function output

Function compose:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 5
filename:       /in/cWBCu
function name:  compose
number of ops:  33
compiled vars:  !0 = $views, !1 = $data, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   33     2      > JMPZ                                                     !1, ->5
   34     3    >   ASSIGN_STATIC_PROP                                       'data'
          4        OP_DATA                                                  !1
   36     5    >   ASSIGN_STATIC_PROP                                       'views'
          6        OP_DATA                                                  !0
   38     7        INIT_FCALL                                               'extract'
          8        FETCH_STATIC_PROP_W          unknown             $5      'data'
          9        SEND_REF                                                 $5
         10        DO_ICALL                                                 
   40    11        INIT_FCALL                                               'ob_start'
         12        DO_ICALL                                                 
   42    13        FETCH_STATIC_PROP_R          unknown             ~8      'views'
         14      > FE_RESET_R                                       $9      ~8, ->21
         15    > > FE_FETCH_R                                               $9, !2, ->21
   44    16    >   FETCH_CONSTANT                                   ~10     'VIEW_PATH'
         17        CONCAT                                           ~11     ~10, !2
         18        CONCAT                                           ~12     ~11, '.php'
         19        INCLUDE_OR_EVAL                                          ~12, REQUIRE
   42    20      > JMP                                                      ->15
         21    >   FE_FREE                                                  $9
   46    22        UNSET_CV                                                 !2
   47    23        INIT_FCALL                                               'ob_get_clean'
         24        DO_ICALL                                         $15     
         25        ASSIGN_STATIC_PROP                                       'content'
         26        OP_DATA                                                  $15
   49    27        INIT_STATIC_METHOD_CALL                                  'output'
         28        FETCH_STATIC_PROP_R          unknown             ~16     'content'
         29        SEND_VAL                                                 ~16
         30        DO_FCALL                                      0  $17     
         31        ECHO                                                     $17
   50    32      > RETURN                                                   null

End of function compose

End of class Contemplate.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.8 ms | 1400 KiB | 21 Q