3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tester { const EMERG = 0; // Emergency: system is unusable const ALERT = 1; // Alert: action must be taken immediately const CRIT = 2; // Critical: critical conditions const ERR = 3; // Error: error conditions const WARN = 4; // Warning: warning conditions const NOTICE = 5; // Notice: normal but significant condition const INFO = 6; // Informational: informational messages const DEBUG = 7; // Debug: debug messages private static $MESSAGE_PREFIXES = array ( Tester::EMERG => "\033[1;31m{EMERG}\033[0m ", Tester::ERR => "\033[1;31m{ERR}\033[0m ", Tester::CRIT => "\033[1;31m{CRIT}\033[0m ", Tester::WARN => "\033[1;33m{WARN}\033[0m ", Tester::DEBUG => "{DEBUG} ", Tester::INFO => "{INFO} ", Tester::NOTICE => "{NOTIC} ", Tester::ALERT => "{ALERT} " ); private static function addPrefix($message, $priority) { // ADDING COLOUR YAYYYY if(array_key_exists($priority, $MESSAGE_PREFIXES)){ // item is in the hastable $prefix = str_pad($MESSAGE_PREFIXES[$priority], 6, " "); $message = $prefix . $message; } return $message; } public static function myLog($message, $priority = Tester::DEBUG, $extras = null) { $message = Tester::addPrefix($message, $priority); echo $message . "\n"; } }; $path = "Blalala"; Tester::myLog("Saving file to third party at : $path", Tester::INFO); Tester::myLog(" "); Tester::myLog("GGSN plugin of monthly usage fraud found ", Tester::INFO); Tester::myLog("ggsnPlugin::handlerCollect collecting hourly data exceeders", Tester::DEBUG); Tester::myLog("Couldn't save file to third patry path at : $path", Tester::ERR); Tester::myLog("Couldn't find flat price for subscriber for billrun ", Tester::ALERT);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PrZd7
function name:  (null)
number of ops:  29
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   ASSIGN                                                   !0, 'Blalala'
   48     1        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
          2        NOP                                                      
          3        FAST_CONCAT                                      ~2      'Saving++file+to+third+party+at+%3A+', !0
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 6
          6        DO_FCALL                                      0          
   49     7        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
          8        SEND_VAL                                                 '+'
          9        DO_FCALL                                      0          
   50    10        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
         11        SEND_VAL                                                 'GGSN+plugin+of+monthly+usage+fraud+found+'
         12        SEND_VAL                                                 6
         13        DO_FCALL                                      0          
   51    14        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
         15        SEND_VAL                                                 'ggsnPlugin%3A%3AhandlerCollect+collecting+hourly+data+exceeders'
         16        SEND_VAL                                                 7
         17        DO_FCALL                                      0          
   52    18        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
         19        NOP                                                      
         20        FAST_CONCAT                                      ~7      'Couldn%27t++save+file+to+third+patry+path+at+%3A+', !0
         21        SEND_VAL                                                 ~7
         22        SEND_VAL                                                 3
         23        DO_FCALL                                      0          
   53    24        INIT_STATIC_METHOD_CALL                                  'Tester', 'myLog'
         25        SEND_VAL                                                 'Couldn%27t+find+flat+price+for+subscriber+for+billrun+'
         26        SEND_VAL                                                 1
         27        DO_FCALL                                      0          
         28      > RETURN                                                   1

Class Tester:
Function addprefix:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/PrZd7
function name:  addPrefix
number of ops:  15
compiled vars:  !0 = $message, !1 = $priority, !2 = $MESSAGE_PREFIXES, !3 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        ARRAY_KEY_EXISTS                                         !1, !2
          3      > JMPZ                                                     ~4, ->13
   31     4    >   INIT_FCALL                                               'str_pad'
          5        FETCH_DIM_R                                      ~5      !2, !1
          6        SEND_VAL                                                 ~5
          7        SEND_VAL                                                 6
          8        SEND_VAL                                                 '+'
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !3, $6
   32    11        CONCAT                                           ~8      !3, !0
         12        ASSIGN                                                   !0, ~8
   35    13    > > RETURN                                                   !0
   36    14*     > RETURN                                                   null

End of function addprefix

Function mylog:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PrZd7
function name:  myLog
number of ops:  11
compiled vars:  !0 = $message, !1 = $priority, !2 = $extras
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        RECV_INIT                                        !2      null
   41     3        INIT_STATIC_METHOD_CALL                                  'Tester', 'addPrefix'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
   43     8        CONCAT                                           ~5      !0, '%0A'
          9        ECHO                                                     ~5
   44    10      > RETURN                                                   null

End of function mylog

End of class Tester.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.78 ms | 1400 KiB | 15 Q