3v4l.org

run code in 300+ PHP versions simultaneously
<?php function toUpperCamelCase(string $text): string { $replacement = ""; $text = delete_all_between('(', ')', $text); $text = str_replace([" de ", " du ", " la ", " le ", " l'", " d'", " et "], ' ', $text); var_dump($text); $text = iconv('utf-8', 'us-ascii//TRANSLIT', $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(string $beginning, string $end, string $string): 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/4ELuE
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     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/4ELuE
function name:  toUpperCamelCase
number of ops:  48
compiled vars:  !0 = $text, !1 = $replacement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, ''
    5     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
    6     8        INIT_FCALL                                               'str_replace'
          9        SEND_VAL                                                 <array>
         10        SEND_VAL                                                 '+'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !0, $5
    7    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
    8    17        INIT_FCALL_BY_NAME                                       'iconv'
         18        SEND_VAL_EX                                              'utf-8'
         19        SEND_VAL_EX                                              'us-ascii%2F%2FTRANSLIT'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $8      
         22        ASSIGN                                                   !0, $8
    9    23        INIT_FCALL                                               'ucwords'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $10     
         26        ASSIGN                                                   !0, $10
   10    27        INIT_FCALL                                               'preg_replace'
         28        SEND_VAL                                                 '%7E%5B%5E%5CpL%5Cd%5D%2B%7Eu'
         29        SEND_VAR                                                 !1
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $12     
         32        ASSIGN                                                   !0, $12
   11    33        INIT_FCALL                                               'trim'
         34        SEND_VAR                                                 !0
         35        SEND_VAR                                                 !1
         36        DO_ICALL                                         $14     
         37        ASSIGN                                                   !0, $14
   12    38        INIT_FCALL                                               'preg_replace'
         39        SEND_VAL                                                 '%7E-%2B%7E'
         40        SEND_VAR                                                 !1
         41        SEND_VAR                                                 !0
         42        DO_ICALL                                         $16     
         43        ASSIGN                                                   !0, $16
   14    44        VERIFY_RETURN_TYPE                                       !0
         45      > RETURN                                                   !0
   15    46*       VERIFY_RETURN_TYPE                                       
         47*     > 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 = 20
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/4ELuE
function name:  delete_all_between
number of ops:  38
compiled vars:  !0 = $beginning, !1 = $end, !2 = $string, !3 = $beginningPos, !4 = $endPos, !5 = $textToDelete
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   19     3        INIT_FCALL                                               'strpos'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
   20     8        INIT_FCALL                                               'strpos'
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !4, $8
   21    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, ->20
   22    18    >   VERIFY_RETURN_TYPE                                       !2
         19      > RETURN                                                   !2
   25    20    >   INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !2
         22        SEND_VAR                                                 !3
         23        STRLEN                                           ~12     !1
         24        ADD                                              ~13     !4, ~12
         25        SUB                                              ~14     ~13, !3
         26        SEND_VAL                                                 ~14
         27        DO_ICALL                                         $15     
         28        ASSIGN                                                   !5, $15
   27    29        INIT_FCALL                                               'str_replace'
         30        SEND_VAR                                                 !5
         31        SEND_VAL                                                 ''
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $17     
         34        VERIFY_RETURN_TYPE                                       $17
         35      > RETURN                                                   $17
   28    36*       VERIFY_RETURN_TYPE                                       
         37*     > RETURN                                                   null

End of function delete_all_between

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.73 ms | 1407 KiB | 31 Q