3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coupeChaine($text, $max) { if (strlen($text) >= $max) { $text = ereg_replace("<[^>]*>", "", $text); $text = substr($text, 0, $max); $positionEspace = strrpos($text, " "); $text = substr($text, 0, $positionEspace)."..."; } return $text; } echo coupeChaine('Ma chaine de <span>Test !!</span>', 15); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dtL6k
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'coupechaine'
          1        SEND_VAL                                                 'Ma+chaine+de+%3Cspan%3ETest+%21%21%3C%2Fspan%3E'
          2        SEND_VAL                                                 15
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   12     5      > RETURN                                                   1

Function coupechaine:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 29
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/dtL6k
function name:  coupeChaine
number of ops:  31
compiled vars:  !0 = $text, !1 = $max, !2 = $positionEspace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        STRLEN                                           ~3      !0
          3        IS_SMALLER_OR_EQUAL                                      !1, ~3
          4      > JMPZ                                                     ~4, ->29
    4     5    >   INIT_FCALL_BY_NAME                                       'ereg_replace'
          6        SEND_VAL_EX                                              '%3C%5B%5E%3E%5D%2A%3E'
          7        SEND_VAL_EX                                              ''
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !0, $5
    5    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !0, $7
    6    17        INIT_FCALL                                               'strrpos'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 '+'
         20        DO_ICALL                                         $9      
         21        ASSIGN                                                   !2, $9
    7    22        INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 0
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $11     
         27        CONCAT                                           ~12     $11, '...'
         28        ASSIGN                                                   !0, ~12
    9    29    > > RETURN                                                   !0
   10    30*     > RETURN                                                   null

End of function coupechaine

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.91 ms | 1390 KiB | 18 Q