3v4l.org

run code in 300+ PHP versions simultaneously
<?php function multiexplode ($arrayOfDelimiters,$string) { $ready = str_replace($arrayOfDelimiters, $arrayOfDelimiters[0], $string); $launch = explode($arrayOfDelimiters[0], $ready); return $launch; } function removeAccent($str){ $encoding='utf-8'; //$accent = "ÀÁÂÃÇÈÉÊËÌÍÎÏÒÓÔÙÚÛÜàáâãçèéêëìíîïòóôõöùúûüýÿ' ,*"; //$removedAccent = "AAAACEEEEIIIIOOOUUUUaaaaceeeeiiiiooooouuuuyy--"; //return str_replace($accent,$removedAccent,$str); // transformer les caractères accentués en entités HTML $str = htmlentities($str, ENT_NOQUOTES, $encoding); // remplacer les entités HTML pour avoir juste le premier caractères non accentués // Exemple : "&ecute;" => "e", "&Ecute;" => "E", "à " => "a" ... $str = preg_replace('#&([A-za-z])(?:acute|grave|cedil|circ|orn|ring|slash|th|tilde|uml);#', '\1', $str); // Remplacer les ligatures tel que : Œ, Æ ... // Exemple "Å“" => "oe" $str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); //remplacer les apostrophe par rien pour la comparaison $str = preg_replace( "#\'#", "", $str ); return $str; } function CnDisplayNameCnamNomJeuneFilleTreatment($sn,$givenname,$nomJeuneFille){ $userToAdd = array(); $nomSansAccent = ucwords(strtoupper(removeAccent($sn))); $prenomSansAccent = ucwords(strtolower(removeAccent($givenname))); if(!empty($nomJeuneFille) && strtolower($nomJeuneFille) != strtolower($sn)){ $njfSansAccent = ucwords(strtoupper(removeAccent($nomJeuneFille))); $userToAdd['cn'] = $njfSansAccent.' '.$nomSansAccent.' '.$prenomSansAccent; $userToAdd['displayname'] = ucfirst(strtolower($givenname))." ".strtoupper($sn)." ".strtoupper($nomJeuneFille); $userToAdd['cnamnomjeunefille'] = ''; $nomjeunefilletraite = array_map('trim',multiexplode(array("," , "/" , "\\" , " " , "-" , "'"),$nomJeuneFille)); foreach($nomjeunefilletraite as $onePartOfTheNoun) if($onePartOfTheNoun != " " && $onePartOfTheNoun != "") $userToAdd['cnamnomjeunefille'] .=strtoupper(removeAccent($onePartOfTheNoun))." " ; //on enlève le dernier espace $userToAdd['cnamnomjeunefille'] = trim($userToAdd['cnamnomjeunefille']); } else{ $userToAdd['cn'] = $nomSansAccent.' '.$prenomSansAccent; $userToAdd['displayname'] = ucfirst(strtolower($givenname))." ".strtoupper($sn); } return $userToAdd; } $tab = CnDisplayNameCnamNomJeuneFilleTreatment("Nomari","Nass-Nass salut","Njf"); var_dump($tab); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aH5o5
function name:  (null)
number of ops:  10
compiled vars:  !0 = $tab
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                               'cndisplaynamecnamnomjeunefilletreatment'
          1        SEND_VAL                                                 'Nomari'
          2        SEND_VAL                                                 'Nass-Nass+salut'
          3        SEND_VAL                                                 'Njf'
          4        DO_FCALL                                      0  $1      
          5        ASSIGN                                                   !0, $1
   63     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   65     9      > RETURN                                                   1

Function multiexplode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aH5o5
function name:  multiexplode
number of ops:  17
compiled vars:  !0 = $arrayOfDelimiters, !1 = $string, !2 = $ready, !3 = $launch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !0
          4        FETCH_DIM_R                                      ~4      !0, 0
          5        SEND_VAL                                                 ~4
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
    4     9        INIT_FCALL                                               'explode'
         10        FETCH_DIM_R                                      ~7      !0, 0
         11        SEND_VAL                                                 ~7
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
    5    15      > RETURN                                                   !3
    6    16*     > RETURN                                                   null

End of function multiexplode

Function removeaccent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aH5o5
function name:  removeAccent
number of ops:  28
compiled vars:  !0 = $str, !1 = $encoding
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, 'utf-8'
   16     2        INIT_FCALL                                               'htmlentities'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
   20     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%23%26%28%5BA-za-z%5D%29%28%3F%3Aacute%7Cgrave%7Ccedil%7Ccirc%7Corn%7Cring%7Cslash%7Cth%7Ctilde%7Cuml%29%3B%23'
         10        SEND_VAL                                                 '%5C1'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !0, $5
   24    14        INIT_FCALL                                               'preg_replace'
         15        SEND_VAL                                                 '%23%26%28%5BA-za-z%5D%7B2%7D%29%28%3F%3Alig%29%3B%23'
         16        SEND_VAL                                                 '%5C1'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $7      
         19        ASSIGN                                                   !0, $7
   27    20        INIT_FCALL                                               'preg_replace'
         21        SEND_VAL                                                 '%23%5C%27%23'
         22        SEND_VAL                                                 ''
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $9      
         25        ASSIGN                                                   !0, $9
   28    26      > RETURN                                                   !0
   29    27*     > RETURN                                                   null

End of function removeaccent

Function cndisplaynamecnamnomjeunefilletreatment:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 106
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 82, Position 2 = 98
Branch analysis from position: 82
2 jumps found. (Code = 78) Position 1 = 83, Position 2 = 98
Branch analysis from position: 83
2 jumps found. (Code = 46) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 97
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
Branch analysis from position: 97
Branch analysis from position: 87
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 123
Branch analysis from position: 123
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 98
Branch analysis from position: 106
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/aH5o5
function name:  CnDisplayNameCnamNomJeuneFilleTreatment
number of ops:  125
compiled vars:  !0 = $sn, !1 = $givenname, !2 = $nomJeuneFille, !3 = $userToAdd, !4 = $nomSansAccent, !5 = $prenomSansAccent, !6 = $njfSansAccent, !7 = $nomjeunefilletraite, !8 = $onePartOfTheNoun
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   32     3        ASSIGN                                                   !3, <array>
   33     4        INIT_FCALL                                               'ucwords'
          5        INIT_FCALL                                               'strtoupper'
          6        INIT_FCALL                                               'removeaccent'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $10     
          9        SEND_VAR                                                 $10
         10        DO_ICALL                                         $11     
         11        SEND_VAR                                                 $11
         12        DO_ICALL                                         $12     
         13        ASSIGN                                                   !4, $12
   34    14        INIT_FCALL                                               'ucwords'
         15        INIT_FCALL                                               'strtolower'
         16        INIT_FCALL                                               'removeaccent'
         17        SEND_VAR                                                 !1
         18        DO_FCALL                                      0  $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                         $15     
         21        SEND_VAR                                                 $15
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !5, $16
   36    24        ISSET_ISEMPTY_CV                                 ~18     !2
         25        BOOL_NOT                                         ~19     ~18
         26      > JMPZ_EX                                          ~19     ~19, ->35
         27    >   INIT_FCALL                                               'strtolower'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $20     
         30        INIT_FCALL                                               'strtolower'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $21     
         33        IS_NOT_EQUAL                                     ~22     $20, $21
         34        BOOL                                             ~19     ~22
         35    > > JMPZ                                                     ~19, ->106
   37    36    >   INIT_FCALL                                               'ucwords'
         37        INIT_FCALL                                               'strtoupper'
         38        INIT_FCALL                                               'removeaccent'
         39        SEND_VAR                                                 !2
         40        DO_FCALL                                      0  $23     
         41        SEND_VAR                                                 $23
         42        DO_ICALL                                         $24     
         43        SEND_VAR                                                 $24
         44        DO_ICALL                                         $25     
         45        ASSIGN                                                   !6, $25
   39    46        CONCAT                                           ~28     !6, '+'
         47        CONCAT                                           ~29     ~28, !4
         48        CONCAT                                           ~30     ~29, '+'
         49        CONCAT                                           ~31     ~30, !5
         50        ASSIGN_DIM                                               !3, 'cn'
         51        OP_DATA                                                  ~31
   40    52        INIT_FCALL                                               'ucfirst'
         53        INIT_FCALL                                               'strtolower'
         54        SEND_VAR                                                 !1
         55        DO_ICALL                                         $33     
         56        SEND_VAR                                                 $33
         57        DO_ICALL                                         $34     
         58        CONCAT                                           ~35     $34, '+'
         59        INIT_FCALL                                               'strtoupper'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $36     
         62        CONCAT                                           ~37     ~35, $36
         63        CONCAT                                           ~38     ~37, '+'
         64        INIT_FCALL                                               'strtoupper'
         65        SEND_VAR                                                 !2
         66        DO_ICALL                                         $39     
         67        CONCAT                                           ~40     ~38, $39
         68        ASSIGN_DIM                                               !3, 'displayname'
         69        OP_DATA                                                  ~40
   42    70        ASSIGN_DIM                                               !3, 'cnamnomjeunefille'
         71        OP_DATA                                                  ''
   44    72        INIT_FCALL                                               'array_map'
         73        SEND_VAL                                                 'trim'
         74        INIT_FCALL                                               'multiexplode'
         75        SEND_VAL                                                 <array>
         76        SEND_VAR                                                 !2
         77        DO_FCALL                                      0  $42     
         78        SEND_VAR                                                 $42
         79        DO_ICALL                                         $43     
         80        ASSIGN                                                   !7, $43
   45    81      > FE_RESET_R                                       $45     !7, ->98
         82    > > FE_FETCH_R                                               $45, !8, ->98
   46    83    >   IS_NOT_EQUAL                                     ~46     !8, '+'
         84      > JMPZ_EX                                          ~46     ~46, ->87
         85    >   IS_NOT_EQUAL                                     ~47     !8, ''
         86        BOOL                                             ~46     ~47
         87    > > JMPZ                                                     ~46, ->97
   47    88    >   INIT_FCALL                                               'strtoupper'
         89        INIT_FCALL                                               'removeaccent'
         90        SEND_VAR                                                 !8
         91        DO_FCALL                                      0  $49     
         92        SEND_VAR                                                 $49
         93        DO_ICALL                                         $50     
         94        CONCAT                                           ~51     $50, '+'
         95        ASSIGN_DIM_OP                .=               8          !3, 'cnamnomjeunefille'
         96        OP_DATA                                                  ~51
   45    97    > > JMP                                                      ->82
         98    >   FE_FREE                                                  $45
   50    99        INIT_FCALL                                               'trim'
        100        FETCH_DIM_R                                      ~53     !3, 'cnamnomjeunefille'
        101        SEND_VAL                                                 ~53
        102        DO_ICALL                                         $54     
        103        ASSIGN_DIM                                               !3, 'cnamnomjeunefille'
        104        OP_DATA                                                  $54
        105      > JMP                                                      ->123
   54   106    >   CONCAT                                           ~56     !4, '+'
        107        CONCAT                                           ~57     ~56, !5
        108        ASSIGN_DIM                                               !3, 'cn'
        109        OP_DATA                                                  ~57
   55   110        INIT_FCALL                                               'ucfirst'
        111        INIT_FCALL                                               'strtolower'
        112        SEND_VAR                                                 !1
        113        DO_ICALL                                         $59     
        114        SEND_VAR                                                 $59
        115        DO_ICALL                                         $60     
        116        CONCAT                                           ~61     $60, '+'
        117        INIT_FCALL                                               'strtoupper'
        118        SEND_VAR                                                 !0
        119        DO_ICALL                                         $62     
        120        CONCAT                                           ~63     ~61, $62
        121        ASSIGN_DIM                                               !3, 'displayname'
        122        OP_DATA                                                  ~63
   58   123    > > RETURN                                                   !3
   59   124*     > RETURN                                                   null

End of function cndisplaynamecnamnomjeunefilletreatment

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.85 ms | 1415 KiB | 41 Q