3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "resource_id_heeelp_lala_klopsiki"; preg_match_all('/(_[\w]{1})/', $string, $matches); if(!empty($matches[0])){ foreach($matches[0] as $key){ $result = substr($key, 1, 1); //result is c print $key.'_'.$result.'<br />'; //$result1=str_replace($result,'',$key);//now your result1 is apitalize //$result2=ucfirst($result1); //now result2 is Apitalize //$finalresult=$result.$result2; ///now your finalresult is cApitalize preg_replace("/".$key."/", ucfirst($result), $string); } } print $string;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 34
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 33
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 33
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 34
filename:       /in/6nsTF
function name:  (null)
number of ops:  36
compiled vars:  !0 = $string, !1 = $matches, !2 = $key, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'resource_id_heeelp_lala_klopsiki'
    3     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28_%5B%5Cw%5D%7B1%7D%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    4     6        ISSET_ISEMPTY_DIM_OBJ                         1  ~6      !1, 0
          7        BOOL_NOT                                         ~7      ~6
          8      > JMPZ                                                     ~7, ->34
    5     9    >   FETCH_DIM_R                                      ~8      !1, 0
         10      > FE_RESET_R                                       $9      ~8, ->33
         11    > > FE_FETCH_R                                               $9, !2, ->33
    7    12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 1
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !3, $10
    8    18        CONCAT                                           ~12     !2, '_'
         19        CONCAT                                           ~13     ~12, !3
         20        CONCAT                                           ~14     ~13, '%3Cbr+%2F%3E'
         21        ECHO                                                     ~14
   13    22        INIT_FCALL                                               'preg_replace'
         23        CONCAT                                           ~15     '%2F', !2
         24        CONCAT                                           ~16     ~15, '%2F'
         25        SEND_VAL                                                 ~16
         26        INIT_FCALL                                               'ucfirst'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $17     
         29        SEND_VAR                                                 $17
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                                 
    5    32      > JMP                                                      ->11
         33    >   FE_FREE                                                  $9
   16    34    >   ECHO                                                     !0
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.28 ms | 1388 KiB | 21 Q