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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.69 ms | 1396 KiB | 21 Q