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 //$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 = 30
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 29
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 30
filename:       /in/8gr2I
function name:  (null)
number of ops:  32
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, ->30
    5     9    >   FETCH_DIM_R                                      ~8      !1, 0
         10      > FE_RESET_R                                       $9      ~8, ->29
         11    > > FE_FETCH_R                                               $9, !2, ->29
    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
   12    18        INIT_FCALL                                               'preg_replace'
         19        CONCAT                                           ~12     '%2F', !2
         20        CONCAT                                           ~13     ~12, '%2F'
         21        SEND_VAL                                                 ~13
         22        INIT_FCALL                                               'ucfirst'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $14     
         25        SEND_VAR                                                 $14
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
    5    28      > JMP                                                      ->11
         29    >   FE_FREE                                                  $9
   15    30    >   ECHO                                                     !0
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.63 ms | 1396 KiB | 21 Q