3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); mb_internal_encoding('utf-8'); $text = "ну что. не смотрел 123еще 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) { $sentences = preg_split("/(?<=[!\?\.])/u", $text, -1, PREG_SPLIT_NO_EMPTY); $countSentences = count($sentences); for ($i = 0; $i <= $countSentences; $i++){ $sentences[1] = trim($sentences[1]); $sentences[$i] = mb_ucfirst($sentences[$i]); } $text=implode($sentences); return($text); } $text = makeFirstLetterUppercase($text); echo $text; /* исправляет текст */ function fixText($text) { /* ... */ } $result = fixText($text); echo "{$result}\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/egKof
function name:  (null)
number of ops:  20
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+123%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.'
   23     7        INIT_FCALL                                               'makefirstletteruppercase'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !0, $5
   24    11        ECHO                                                     !0
   33    12        INIT_FCALL                                               'fixtext'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0  $7      
         15        ASSIGN                                                   !1, $7
   34    16        NOP                                                      
         17        FAST_CONCAT                                      ~9      !1, '%0A'
         18        ECHO                                                     ~9
         19      > RETURN                                                   1

Function makefirstletteruppercase:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
Branch analysis from position: 12
filename:       /in/egKof
function name:  makeFirstLetterUppercase
number of ops:  34
compiled vars:  !0 = $text, !1 = $sentences, !2 = $countSentences, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%28%3F%3C%3D%5B%21%5C%3F%5C.%5D%29%2Fu'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 -1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   15     8        COUNT                                            ~6      !1
          9        ASSIGN                                                   !2, ~6
   16    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->26
   17    12    >   INIT_FCALL                                               'trim'
         13        FETCH_DIM_R                                      ~10     !1, 1
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                         $11     
         16        ASSIGN_DIM                                               !1, 1
         17        OP_DATA                                                  $11
   18    18        INIT_FCALL_BY_NAME                                       'mb_ucfirst'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $13     !1, !3
         21        SEND_FUNC_ARG                                            $13
         22        DO_FCALL                                      0  $14     
         23        ASSIGN_DIM                                               !1, !3
         24        OP_DATA                                                  $14
   16    25        PRE_INC                                                  !3
         26    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         27      > JMPNZ                                                    ~16, ->12
   20    28    >   INIT_FCALL                                               'implode'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $17     
         31        ASSIGN                                                   !0, $17
   21    32      > RETURN                                                   !0
   22    33*     > 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/egKof
function name:  fixText
number of ops:  2
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   31     1      > RETURN                                                   null

End of function fixtext

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.05 ms | 1403 KiB | 25 Q