3v4l.org

run code in 300+ PHP versions simultaneously
<?php function toUpperCamelCase($text) { $replacement = ""; $text = delete_all_between('(', ')', $text); $text = iconv('UTF-8', 'ASCII//TRANSLIT', $text); var_dump($text); $text = preg_replace("/(\b(de|du|la|le|et)\b)|(\b((l|d)[',’]))/i", ' ', $text); var_dump($text); $text = ucwords($text); $text = preg_replace('~[^\pL\d]+~u', $replacement, $text); $text = trim($text, $replacement); $text = preg_replace('~-+~', $replacement, $text); return $text; } function delete_all_between($beginning, $end, $string) { $beginningPos = strpos($string, $beginning); $endPos = strpos($string, $end); if ($beginningPos === false || $endPos === false) { return $string; } $textToDelete = substr($string, $beginningPos, ($endPos + strlen($end)) - $beginningPos); return str_replace($textToDelete, '', $string); } echo toUpperCamelCase("Identifiant de l’organisme destinataire de la déclaration néant");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pEugQ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'touppercamelcase'
          1        SEND_VAL                                                 'Identifiant+de+l%E2%80%99organisme+destinataire+de+la+d%C3%A9claration+n%C3%A9ant'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function touppercamelcase:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pEugQ
function name:  toUpperCamelCase
number of ops:  49
compiled vars:  !0 = $text, !1 = $replacement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        INIT_FCALL_BY_NAME                                       'delete_all_between'
          3        SEND_VAL_EX                                              '%28'
          4        SEND_VAL_EX                                              '%29'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
    7     8        INIT_FCALL_BY_NAME                                       'iconv'
          9        SEND_VAL_EX                                              'UTF-8'
         10        SEND_VAL_EX                                              'ASCII%2F%2FTRANSLIT'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $5      
         13        ASSIGN                                                   !0, $5
    8    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
    9    17        INIT_FCALL                                               'preg_replace'
         18        SEND_VAL                                                 '%2F%28%5Cb%28de%7Cdu%7Cla%7Cle%7Cet%29%5Cb%29%7C%28%5Cb%28%28l%7Cd%29%5B%27%2C%E2%80%99%5D%29%29%2Fi'
         19        SEND_VAL                                                 '+'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $8      
         22        ASSIGN                                                   !0, $8
   10    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   12    26        INIT_FCALL                                               'ucwords'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $11     
         29        ASSIGN                                                   !0, $11
   13    30        INIT_FCALL                                               'preg_replace'
         31        SEND_VAL                                                 '%7E%5B%5E%5CpL%5Cd%5D%2B%7Eu'
         32        SEND_VAR                                                 !1
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $13     
         35        ASSIGN                                                   !0, $13
   14    36        INIT_FCALL                                               'trim'
         37        SEND_VAR                                                 !0
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                         $15     
         40        ASSIGN                                                   !0, $15
   15    41        INIT_FCALL                                               'preg_replace'
         42        SEND_VAL                                                 '%7E-%2B%7E'
         43        SEND_VAR                                                 !1
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                         $17     
         46        ASSIGN                                                   !0, $17
   17    47      > RETURN                                                   !0
   18    48*     > RETURN                                                   null

End of function touppercamelcase

Function delete_all_between:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/pEugQ
function name:  delete_all_between
number of ops:  35
compiled vars:  !0 = $beginning, !1 = $end, !2 = $string, !3 = $beginningPos, !4 = $endPos, !5 = $textToDelete
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   22     3        INIT_FCALL                                               'strpos'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
   23     8        INIT_FCALL                                               'strpos'
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !4, $8
   24    13        TYPE_CHECK                                    4  ~10     !3
         14      > JMPNZ_EX                                         ~10     ~10, ->17
         15    >   TYPE_CHECK                                    4  ~11     !4
         16        BOOL                                             ~10     ~11
         17    > > JMPZ                                                     ~10, ->19
   25    18    > > RETURN                                                   !2
   28    19    >   INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !3
         22        STRLEN                                           ~12     !1
         23        ADD                                              ~13     !4, ~12
         24        SUB                                              ~14     ~13, !3
         25        SEND_VAL                                                 ~14
         26        DO_ICALL                                         $15     
         27        ASSIGN                                                   !5, $15
   30    28        INIT_FCALL                                               'str_replace'
         29        SEND_VAR                                                 !5
         30        SEND_VAL                                                 ''
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $17     
         33      > RETURN                                                   $17
   31    34*     > RETURN                                                   null

End of function delete_all_between

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.82 ms | 1407 KiB | 31 Q