3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** Ejemplo pàra post: https://trasweb.net/blog/optimizacion-web/optimizacion-de-funciones-php */ $vista = new stdclass; function get_menu() { static $cache = null; if(isset($cache) ) return $cache; error_log('Se inicia la creación de menú'); $menu[] = ['title' => 'Inicio', 'href' => '/']; $menu[] = ['title' => 'Servicios', 'href' => '/servicios']; $menu[] = ['title' => 'Quiénes somos', 'href' => '/quienes-somos']; $menu[] = ['title' => 'Blog', 'href' => '/blog']; $menu[] = ['title' => 'Contacto', 'href' => '/contacto']; error_log('Se finaliza la creación de menú'); return $cache = $menu; } if(!empty(get_menu()) ) { $vista->menu = get_menu(); $vista->menu_inferior = get_menu(); $vista->template = 'vista_con_menu'; }else { $vista->template = 'vista_sin_menu'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WgKka
function name:  (null)
number of ops:  22
compiled vars:  !0 = $vista
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'stdclass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_FCALL                                               'get_menu'
          4        DO_FCALL                                      0  $4      
          5        BOOL_NOT                                         ~5      $4
          6        BOOL_NOT                                         ~6      ~5
          7      > JMPZ                                                     ~6, ->19
   27     8    >   INIT_FCALL                                               'get_menu'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN_OBJ                                               !0, 'menu'
         11        OP_DATA                                                  $8
   28    12        INIT_FCALL                                               'get_menu'
         13        DO_FCALL                                      0  $10     
         14        ASSIGN_OBJ                                               !0, 'menu_inferior'
         15        OP_DATA                                                  $10
   29    16        ASSIGN_OBJ                                               !0, 'template'
         17        OP_DATA                                                  'vista_con_menu'
         18      > JMP                                                      ->21
   31    19    >   ASSIGN_OBJ                                               !0, 'template'
         20        OP_DATA                                                  'vista_sin_menu'
   32    21    > > RETURN                                                   1

Function get_menu:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WgKka
function name:  get_menu
number of ops:  23
compiled vars:  !0 = $cache, !1 = $menu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~2, ->4
          3    > > RETURN                                                   !0
   12     4    >   INIT_FCALL                                               'error_log'
          5        SEND_VAL                                                 'Se+inicia+la+creaci%C3%B3n+de+men%C3%BA'
          6        DO_ICALL                                                 
   14     7        ASSIGN_DIM                                               !1
          8        OP_DATA                                                  <array>
   15     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  <array>
   16    11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  <array>
   17    13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  <array>
   18    15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  <array>
   20    17        INIT_FCALL                                               'error_log'
         18        SEND_VAL                                                 'Se+finaliza+la+creaci%C3%B3n+de+men%C3%BA'
         19        DO_ICALL                                                 
   22    20        ASSIGN                                           ~10     !0, !1
         21      > RETURN                                                   ~10
   23    22*     > RETURN                                                   null

End of function get_menu

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1403 KiB | 18 Q