3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); mb_internal_encoding('utf-8'); $text = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было."; // Для тестов // $text = 'roses are red,and violets are blue.whatever you do i'll keep it for you.'; // $text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.'; /* Делает первую букву в строке заглавной */ function makeFirstLetterUppercase($text) { $regexp = '/[.!?]/'; $parts = preg_split($regexp, $text, 0, PREG_SPLIT_NO_EMPTY); for ($i = 0; $i<= count($parts); $i++) { $parts[$i] = str_replace(' ', '#', $parts[$i]); $parts[$i] = mb_convert_case( $parts[$i], MB_CASE_TITLE, "UTF-8"); $parts[$i] = str_replace('#', ' ', $parts[$i]); return $parts; } $text = implode(".", $parts); } /* исправляет текст */ function fixText($text) { /* ... */ } $result = makeFirstLetterUppercase($text); echo "{$result}\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5q8Qb
function name:  (null)
number of ops:  15
compiled vars:  !0 = $text, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'mb_internal_encoding'
          4        SEND_VAL                                                 'utf-8'
          5        DO_ICALL                                                 
    6     6        ASSIGN                                                   !0, '%D0%BD%D1%83+%D1%87%D1%82%D0%BE.++++++%D0%BD%D0%B5+%D1%81%D0%BC%D0%BE%D1%82%D1%80%D0%B5%D0%BB+%D0%B5%D1%89%D0%B5+black+mesa.%D1%8F+%D1%81%D0%BE%D0%B1%D0%B8%D1%80%D0%B0%D0%BB%D1%81%D1%8F+%D1%81%D0%BA%D0%B0%D1%87%D0%B0%D1%82%D1%8C++%2C%D0%BD%D0%BE+%D0%B2%D1%81%D0%B5+%D0%BA%D0%B0%D0%BA-%D1%82%D0%BE+%D0%BD%D0%B5%D0%BA%D0%BE%D0%B3%D0%B4%D0%B0+%D0%B1%D1%8B%D0%BB%D0%BE.'
   39     7        INIT_FCALL                                               'makefirstletteruppercase'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !1, $5
   40    11        NOP                                                      
         12        FAST_CONCAT                                      ~7      !1, '%0A'
         13        ECHO                                                     ~7
         14      > RETURN                                                   1

Function makefirstletteruppercase:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 11
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5q8Qb
function name:  makeFirstLetterUppercase
number of ops:  46
compiled vars:  !0 = $text, !1 = $regexp, !2 = $parts, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, '%2F%5B.%21%3F%5D%2F'
   15     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
   17     9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->37
   19    11    >   INIT_FCALL                                               'str_replace'
         12        SEND_VAL                                                 '+'
         13        SEND_VAL                                                 '%23'
         14        FETCH_DIM_R                                      ~9      !2, !3
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                         $10     
         17        ASSIGN_DIM                                               !2, !3
         18        OP_DATA                                                  $10
   20    19        INIT_FCALL                                               'mb_convert_case'
         20        FETCH_DIM_R                                      ~12     !2, !3
         21        SEND_VAL                                                 ~12
         22        SEND_VAL                                                 2
         23        SEND_VAL                                                 'UTF-8'
         24        DO_ICALL                                         $13     
         25        ASSIGN_DIM                                               !2, !3
         26        OP_DATA                                                  $13
   21    27        INIT_FCALL                                               'str_replace'
         28        SEND_VAL                                                 '%23'
         29        SEND_VAL                                                 '+'
         30        FETCH_DIM_R                                      ~15     !2, !3
         31        SEND_VAL                                                 ~15
         32        DO_ICALL                                         $16     
         33        ASSIGN_DIM                                               !2, !3
         34        OP_DATA                                                  $16
   23    35      > RETURN                                                   !2
   17    36*       PRE_INC                                                  !3
         37    >   COUNT                                            ~18     !2
         38        IS_SMALLER_OR_EQUAL                                      !3, ~18
         39      > JMPNZ                                                    ~19, ->11
   27    40    >   INIT_FCALL                                               'implode'
         41        SEND_VAL                                                 '.'
         42        SEND_VAR                                                 !2
         43        DO_ICALL                                         $20     
         44        ASSIGN                                                   !0, $20
   30    45      > RETURN                                                   null

End of function makefirstletteruppercase

Function fixtext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5q8Qb
function name:  fixText
number of ops:  2
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   37     1      > RETURN                                                   null

End of function fixtext

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.23 ms | 1403 KiB | 26 Q