3v4l.org

run code in 300+ 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:  34
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        INIT_FCALL                                               'trim'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        STRLEN                                           ~6      $5
          9        CONCAT                                           ~7      'Length+with+trim+and+nbsp%3A+', ~6
         10        CONCAT                                           ~8      ~7, '%0A'
         11        ECHO                                                     ~8
    7    12        INIT_FCALL                                               'trim'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        STRLEN                                           ~10     $9
         16        CONCAT                                           ~11     'Length+with+trim+and+space%3A+', ~10
         17        CONCAT                                           ~12     ~11, '%0A'
         18        ECHO                                                     ~12
    8    19        INIT_FCALL_BY_NAME                                       'mb_trim'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $13     
         22        STRLEN                                           ~14     $13
         23        CONCAT                                           ~15     'Length+with+mb_trim+and+nbsp%3A+', ~14
         24        CONCAT                                           ~16     ~15, '%0A'
         25        ECHO                                                     ~16
    9    26        INIT_FCALL_BY_NAME                                       'mb_trim'
         27        SEND_VAR_EX                                              !1
         28        DO_FCALL                                      0  $17     
         29        STRLEN                                           ~18     $17
         30        CONCAT                                           ~19     'Length+with+mb_trim+and+space%3A+', ~18
         31        CONCAT                                           ~20     ~19, '%0A'
         32        ECHO                                                     ~20
   10    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.2 ms | 1000 KiB | 15 Q