3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 0 => 'ACHNANTHES Bory, Dict. Class. Hist. Nat. 1: 79 (1822). / SUCINCIĞI.', 1 => 'A. brevipes C.Agardh, Syst. Alg.: 1 (1824). / Küçük sucıncığı.', 2 => 'A. coarctata (Bréb. ex W.Sm.) Grunow, Syn. Diat. Belg.: expl. pl. XXVI: ş. 17 (1880). / Dar sucıncığı.', 3 => 'A. cocconeiformis Mann, U.S. Nat. Mus., Bull. 6: 182 (1925). / Top sucıncığı.', 4 => 'A. gibberula Grunow, Kongl. Svenska Vetensk.-Akad. Handl. 17(2): 121 (1880). / Kambur sucıncığı.', 5 => 'A. lacunarum Hust., Bacillariophyta (Diatomeae) Zweite Auflage, Süsswass.-Fl. Mitteleurop. 10: 205 (1930). / Delikli sucıncığı.', 6 => 'A. lineariformis Lange-Bert., Biblioth. Diatomol. 27: 7, 134 pl. (1993). / Düz sucıncığı.', 7 => 'A. longipes C.Agardh, Syst. Alg.: 1 (1824). / Boylu sucıncığı.', 8 => 'A. nollii Bock, Nachrichtendes Naturwiss. Museums Stadt Aschaffenburg 38: 1 (1953). / Yaban sucıncığı.', 9 => 'A. parvula Kütz., Bacillarien: 76, pl. 21: ş. 5 (1844). / Saf sucıncığı.', 10 => 'A. petersenii Hust., Rabenhorst’s Krypt.-Fl. Deutschl.: 179, ş 10-14 (1937). / Bal sucıncığı.', 11 => 'A. pyrenaicum (Hust.) H.Kobayasi, Nova Hedwigia 65(1-4): 148, ş. 1-18 (1997). / Garip sucıncığı.', 12 => 'A. stolida (Krasske) Krasske, Ann. Acad. Sc. Fenn., ser. A, Biol. 14: 78 (1949). / Alık sucıncığı.', 13 => 'A. thermalis (Rabenh.) Schoenfeld, Diat. German.: 122 (1907). / Sıcak sucıncığı.', 14 => 'A. trinodis (Ralfs) Grunow, Syn. Diatom. Belg.: pl. XXVII: ş. 50 (1880). / Üç sucıncığı.', 15 => 'A. wellsiae Reimer, Monogr. Acad. Nat. Sci. Philadelphia 1: 16 (1966). / El sucıncığı.', 16 => 'PLATESSA Lange-Bert., Süsswass.-Fl. Mitteleuropa 2: 443 (2004). / SUTANESİ.', 17 => 'P. conspicua (Ant.Mayer) Lange-Bert., Süsswass.-Fl. Mitteleuropa 2: 445 (2004). / Küt sutanesi.', 18 => 'P. montana (Krasske) Lange-Bert., Süsswass.-Fl. Mitteleuropa 2: 445 (2004). / Dağ sutanesi.', 19 => 'P. salinarum (Grunow) Lange-Bert. / Sutanesi.', 20 => 'ACHNANTHIDIUM Kütz., Bacillarien: 75 (1844). / SUÇUBUĞU.', 21 => 'A. affine (Grunow) Czarn., Mem. Calif. Acad. Sci. 17: 156 (1994). / Hoş suçubuğu.', 22 => 'A. deflexum Kingston, Diatom Res. 15(2): 409 (2000). / Kıvrık suçubuğu.', 23 => 'A. exiguum (Grunow) Czarnecki, Mem. Calif. Acad. Sci. 17: 155 (1994). / Delikli suçubuğu.', 24 => 'A. exile (Kütz.) Heiberg, Conspect. Diatom. Dan.: 119 (1863). / Bitik suçubuğu.', 25 => 'A. lanceolatum (Bréb.) Kütz., Bot. Zeitung 4(14): 247 (1846). / Uzun suçubuğu.', 26 => 'A. minutissimum (Kütz.) Czarn., Mem. Calif. Acad. Sci. 17: 155 (1994). / Cüce suçubuğu.', 27 => 'A. minutum Cleve, Fl. Fenn. 8(2): 1 (1891). / Bodur suçubuğu.', 28 => 'A. thermale Rabenh., Fl. Eur. Alg. 1: 107 (1864). / Sıcak suçubuğu.', 29 => 'EUCOCCONEIS Cleve ex Meister, Beitr. Kryptogamenfl. Schweiz IV(1): 95 (1912). / SUESNEĞİ.', 30 => 'E. flexella (Kütz.) Meister, Beitr. Kryptogamenfl. Schweiz IV(1): 95 (1912). / Suesneği.', 31 => 'E. laevis (Østrup) Lange-Bert., Iconogr. Diatomol. 6: 46 (1999). / Pek suesneği.', 32 => 'E. quadratarea (Østrup) Lange-Bert., Iconogr. Diatomol. 6: 48 (1999). / Dört suesneği.', ]; $result = []; $currentGenus = null; foreach ($array as $line) { $firstWord = strstr($line, ' ', true); if (ctype_upper($firstWord)) { $currentGenus = $firstWord; $result[] = $firstWord; } else { $result[] = ucfirst(strtolower($currentGenus)) . ' ' . explode(' ', $line, 3)[1]; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 33
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/V8uAE
function name:  (null)
number of ops:  38
compiled vars:  !0 = $array, !1 = $result, !2 = $currentGenus, !3 = $line, !4 = $firstWord
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   39     1        ASSIGN                                                       !1, <array>
   40     2        ASSIGN                                                       !2, null
   41     3      > FE_RESET_R                                           $8      !0, ->33
          4    > > FE_FETCH_R                                                   $8, !3, ->33
   42     5    >   FRAMELESS_ICALL_3                strstr              ~9      !3, '+'
          6        OP_DATA                                                      <true>
          7        ASSIGN                                                       !4, ~9
   43     8        INIT_FCALL                                                   'ctype_upper'
          9        SEND_VAR                                                     !4
         10        DO_ICALL                                             $11     
         11      > JMPZ                                                         $11, ->16
   44    12    >   ASSIGN                                                       !2, !4
   45    13        ASSIGN_DIM                                                   !1
         14        OP_DATA                                                      !4
   43    15      > JMP                                                          ->32
   47    16    >   INIT_FCALL                                                   'ucfirst'
         17        INIT_FCALL                                                   'strtolower'
         18        SEND_VAR                                                     !2
         19        DO_ICALL                                             $15     
         20        SEND_VAR                                                     $15
         21        DO_ICALL                                             $16     
         22        CONCAT                                               ~17     $16, '+'
         23        INIT_FCALL                                                   'explode'
         24        SEND_VAL                                                     '+'
         25        SEND_VAR                                                     !3
         26        SEND_VAL                                                     3
         27        DO_ICALL                                             $18     
         28        FETCH_DIM_R                                          ~19     $18, 1
         29        CONCAT                                               ~20     ~17, ~19
         30        ASSIGN_DIM                                                   !1
         31        OP_DATA                                                      ~20
   41    32    > > JMP                                                          ->4
         33    >   FE_FREE                                                      $8
   50    34        INIT_FCALL                                                   'var_export'
         35        SEND_VAR                                                     !1
         36        DO_ICALL                                                     
         37      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.77 ms | 2402 KiB | 20 Q