3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/"_raw": (.*)(?=,)/m'; $str = '{ "result": { "_raw": "Jun 30 06:51:04 blablabla.com apache2: event_id="something" event="something" app="testapp" serial_number="066f1cda" revoke_reason="key compromise" revoke_comment="xxxxxx" delay_revoke="15" url="/blablabla.php" account_id="123456" user_id="xxxxxxx" staff_id="xxxx" staff_name="todd" ip_address="123.123.123.123"", "splunk_server": "splunkin02.localhost.com" }, "results_link": "https://splunk.sffew.com", "app": "search", "search_name": "TEST", "owner": "toodles@sfsfe.com", "sid": "scheduler_blahlahlah" }'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); $parsable_array = explode(' ',$matches[0][1]); $expected_array = array_filter($parsable_array, function ($var) { return (stripos($var, '=') != false); }); $final_result = []; foreach($expected_array as $str){ list($key,$value) = explode('=',$str); $final_result[$key] = trim($value,'"'); } print_r($final_result); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 41
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 41
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/fFQSZ
function name:  (null)
number of ops:  46
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $parsable_array, !4 = $expected_array, !5 = $final_result, !6 = $key, !7 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2F%22_raw%22%3A+%28.%2A%29%28%3F%3D%2C%29%2Fm'
    3     1        ASSIGN                                                   !1, '%7B%0A++++%22result%22%3A+%7B%0A++++++++%22_raw%22%3A+%22Jun+30+06%3A51%3A04+blablabla.com+apache2%3A+event_id%3D%22something%22+event%3D%22something%22+app%3D%22testapp%22+serial_number%3D%22066f1cda%22+revoke_reason%3D%22key+compromise%22+revoke_comment%3D%22xxxxxx%22+delay_revoke%3D%2215%22+url%3D%22%2Fblablabla.php%22+account_id%3D%22123456%22+user_id%3D%22xxxxxxx%22+staff_id%3D%22xxxx%22+staff_name%3D%22todd%22+ip_address%3D%22123.123.123.123%22%22%2C%0A++++++++%22splunk_server%22%3A+%22splunkin02.localhost.com%22%0A++++%7D%2C%0A++++%22results_link%22%3A+%22https%3A%2F%2Fsplunk.sffew.com%22%2C%0A++++%22app%22%3A+%22search%22%2C%0A++++%22search_name%22%3A+%22TEST%22%2C%0A++++%22owner%22%3A+%22toodles%40sfsfe.com%22%2C%0A++++%22sid%22%3A+%22scheduler_blahlahlah%22%0A%7D'
   15     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 2
          7        SEND_VAL                                                 0
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '+'
         11        FETCH_DIM_R                                      ~11     !2, 0
         12        FETCH_DIM_R                                      ~12     ~11, 1
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !3, $13
   17    16        INIT_FCALL                                               'array_filter'
         17        SEND_VAR                                                 !3
         18        DECLARE_LAMBDA_FUNCTION                          ~15     [0]
         19        SEND_VAL                                                 ~15
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !4, $16
   18    22        ASSIGN                                                   !5, <array>
   19    23      > FE_RESET_R                                       $19     !4, ->41
         24    > > FE_FETCH_R                                               $19, !1, ->41
   20    25    >   INIT_FCALL                                               'explode'
         26        SEND_VAL                                                 '%3D'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $20     
         29        FETCH_LIST_R                                     $21     $20, 0
         30        ASSIGN                                                   !6, $21
         31        FETCH_LIST_R                                     $23     $20, 1
         32        ASSIGN                                                   !7, $23
         33        FREE                                                     $20
   21    34        INIT_FCALL                                               'trim'
         35        SEND_VAR                                                 !7
         36        SEND_VAL                                                 '%22'
         37        DO_ICALL                                         $26     
         38        ASSIGN_DIM                                               !5, !6
         39        OP_DATA                                                  $26
   19    40      > JMP                                                      ->24
         41    >   FE_FREE                                                  $19
   24    42        INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !5
         44        DO_ICALL                                                 
   27    45      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFQSZ
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'stripos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3D'
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6      > RETURN                                                   ~2
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.14 ms | 1021 KiB | 19 Q