3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = html_entity_decode('ABC&nbsp;'); $b = 'ABC '; echo 'Length with trim and nbsp: '.strlen(trim($a)).PHP_EOL; echo 'Length with trim and space: '.strlen(trim($b)).PHP_EOL; echo 'Length with mb_trim and nbsp: '.strlen(mb_trim($a)).PHP_EOL; echo 'Length with mb_trim and space: '.strlen(mb_trim($b)).PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hMC7A
function name:  (null)
number of ops:  30
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'html_entity_decode'
          1        SEND_VAL                                                     'ABC%26nbsp%3B'
          2        DO_ICALL                                             $2      
          3        ASSIGN                                                       !0, $2
    4     4        ASSIGN                                                       !1, 'ABC+'
    6     5        FRAMELESS_ICALL_1                trim                ~5      !0
          6        STRLEN                                               ~6      ~5
          7        CONCAT                                               ~7      'Length+with+trim+and+nbsp%3A+', ~6
          8        CONCAT                                               ~8      ~7, '%0A'
          9        ECHO                                                         ~8
    7    10        FRAMELESS_ICALL_1                trim                ~9      !1
         11        STRLEN                                               ~10     ~9
         12        CONCAT                                               ~11     'Length+with+trim+and+space%3A+', ~10
         13        CONCAT                                               ~12     ~11, '%0A'
         14        ECHO                                                         ~12
    8    15        INIT_FCALL                                                   'mb_trim'
         16        SEND_VAR                                                     !0
         17        DO_ICALL                                             $13     
         18        STRLEN                                               ~14     $13
         19        CONCAT                                               ~15     'Length+with+mb_trim+and+nbsp%3A+', ~14
         20        CONCAT                                               ~16     ~15, '%0A'
         21        ECHO                                                         ~16
    9    22        INIT_FCALL                                                   'mb_trim'
         23        SEND_VAR                                                     !1
         24        DO_ICALL                                             $17     
         25        STRLEN                                               ~18     $17
         26        CONCAT                                               ~19     'Length+with+mb_trim+and+space%3A+', ~18
         27        CONCAT                                               ~20     ~19, '%0A'
         28        ECHO                                                         ~20
   10    29      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.52 ms | 1463 KiB | 15 Q