3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseErrorMessage($string) { $pairs=array_chunk(preg_split('/\R*(Error \w+) - /',$string,NULL,PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE),2); return array_combine(array_column($pairs,0),array_column($pairs,1)); } $string ="Error Type - Database Error Message - Error Executing Database Something is wrong. Error Detail - [Macromedia] [SQLServer JDBC Driver] [SQLServer]Incorrect syntax near '1'."; var_export(parseErrorMessage($string));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UECG1
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'Error+Type+-+Database%0AError+Message+-+Error+Executing+Database+Something+is+wrong.%0AError+Detail+-+%5BMacromedia%5D%0A%5BSQLServer+JDBC+Driver%5D%0A%5BSQLServer%5DIncorrect+syntax+near+%271%27.'
   12     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'parseerrormessage'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function parseerrormessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UECG1
function name:  parseErrorMessage
number of ops:  26
compiled vars:  !0 = $string, !1 = $pairs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'array_chunk'
          2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5CR%2A%28Error+%5Cw%2B%29+-+%2F'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 null
          6        SEND_VAL                                                 3
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        SEND_VAL                                                 2
         10        DO_ICALL                                         $3      
         11        ASSIGN                                                   !1, $3
    4    12        INIT_FCALL                                               'array_combine'
         13        INIT_FCALL                                               'array_column'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 0
         16        DO_ICALL                                         $5      
         17        SEND_VAR                                                 $5
         18        INIT_FCALL                                               'array_column'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                         $7      
         24      > RETURN                                                   $7
    5    25*     > RETURN                                                   null

End of function parseerrormessage

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.01 ms | 1403 KiB | 24 Q