3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); $text = "It seems that they found us? We must urgently leave here, before it's too late. Let's run fast!"; //$text = "Ну, прости меня! Не хотела я тебе зла сделать; да в себе не вольна была. Что говорила, что делала, себя не помнила."; //$text = "Идет гражданская война. Космические корабли повстанцев, наносящие удар с тайной базы, одержали первую победу, в схватке со зловещей Галактической Империей."; $editedText =""; function makeYodaStyleText($text) { $arrayOffers = preg_split('!(\\.)|(\\!)|(\\?)!ui',$text,-1,PREG_SPLIT_NO_EMPTY); foreach ($arrayOffers as $key=>$value){ $arrayWords = preg_split("/[\s]+/",$value); $arrayWords2 = array_reverse ($arrayWords); $glue = " "; $editedText .= implode($glue,$arrayWords2); echo $editedText."1\n"; $editedText.="."; } $editedText = strtolower($text); $editedText = preg_replace('/([а-яёА-ЯЁa-z0-9«]*)(\s)([\.\,\;\:\!\?\»])/iu', '$1$3', $editedText); $editedText = preg_replace('/([\.\,\;\:\!\?\»])([а-яёА-ЯЁa-z0-9«])/iu', '$1 $2', $editedText); return $text; } $yodaText = makeYodaStyleText($text); echo "Йода говорит: {$yodaText}\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8jWC9
function name:  (null)
number of ops:  14
compiled vars:  !0 = $text, !1 = $editedText, !2 = $yodaText
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, 'It+seems+that+they+found+us%3F+We+must+urgently+leave+here%2C+before+it%27s+too+late.+Let%27s+run+fast%21'
    7     4        ASSIGN                                                   !1, ''
   26     5        INIT_FCALL                                               'makeyodastyletext'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !2, $6
   27     9        ROPE_INIT                                     3  ~9      '%D0%99%D0%BE%D0%B4%D0%B0+%D0%B3%D0%BE%D0%B2%D0%BE%D1%80%D0%B8%D1%82%3A+'
         10        ROPE_ADD                                      1  ~9      ~9, !2
         11        ROPE_END                                      2  ~8      ~9, '%0A'
         12        ECHO                                                     ~8
         13      > RETURN                                                   1

Function makeyodastyletext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 30
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/8jWC9
function name:  makeYodaStyleText
number of ops:  49
compiled vars:  !0 = $text, !1 = $arrayOffers, !2 = $value, !3 = $key, !4 = $arrayWords, !5 = $arrayWords2, !6 = $glue, !7 = $editedText
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%21%28%5C.%29%7C%28%5C%21%29%7C%28%5C%3F%29%21ui'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 -1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !1, $8
   11     8      > FE_RESET_R                                       $10     !1, ->30
          9    > > FE_FETCH_R                                       ~11     $10, !2, ->30
         10    >   ASSIGN                                                   !3, ~11
   12    11        INIT_FCALL                                               'preg_split'
         12        SEND_VAL                                                 '%2F%5B%5Cs%5D%2B%2F'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !4, $13
   13    16        INIT_FCALL                                               'array_reverse'
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !5, $15
   14    20        ASSIGN                                                   !6, '+'
   15    21        INIT_FCALL                                               'implode'
         22        SEND_VAR                                                 !6
         23        SEND_VAR                                                 !5
         24        DO_ICALL                                         $18     
         25        ASSIGN_OP                                     8          !7, $18
   16    26        CONCAT                                           ~20     !7, '1%0A'
         27        ECHO                                                     ~20
   17    28        ASSIGN_OP                                     8          !7, '.'
   11    29      > JMP                                                      ->9
         30    >   FE_FREE                                                  $10
   19    31        INIT_FCALL                                               'strtolower'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $22     
         34        ASSIGN                                                   !7, $22
   20    35        INIT_FCALL                                               'preg_replace'
         36        SEND_VAL                                                 '%2F%28%5B%D0%B0-%D1%8F%D1%91%D0%90-%D0%AF%D0%81a-z0-9%C2%AB%5D%2A%29%28%5Cs%29%28%5B%5C.%5C%2C%5C%3B%5C%3A%5C%21%5C%3F%5C%C2%BB%5D%29%2Fiu'
         37        SEND_VAL                                                 '%241%243'
         38        SEND_VAR                                                 !7
         39        DO_ICALL                                         $24     
         40        ASSIGN                                                   !7, $24
   21    41        INIT_FCALL                                               'preg_replace'
         42        SEND_VAL                                                 '%2F%28%5B%5C.%5C%2C%5C%3B%5C%3A%5C%21%5C%3F%5C%C2%BB%5D%29%28%5B%D0%B0-%D1%8F%D1%91%D0%90-%D0%AF%D0%81a-z0-9%C2%AB%5D%29%2Fiu'
         43        SEND_VAL                                                 '%241+%242'
         44        SEND_VAR                                                 !7
         45        DO_ICALL                                         $26     
         46        ASSIGN                                                   !7, $26
   22    47      > RETURN                                                   !0
   24    48*     > RETURN                                                   null

End of function makeyodastyletext

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.8 ms | 1403 KiB | 26 Q