3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyMorse { private array $plainTextsByMorseCode = [ '.-' => 'A', '....' => 'H', '.-..' => 'L', '-.' => 'N', '---' => 'O', '.--.' => 'P', '...' => 'S', '-' => 'T', '..-' => 'U', '-.--' => 'Y', ]; public function decode(string $morseCode): string { return strtr($morseCode, $this->plainTextsByMorseCode + [' ' => ' ', ' ' => '']); } } $obj = new MyMorse(); var_export( $obj->decode('-.-- --- ..- ... .... .- .-.. .-.. -. --- - .--. .- ... ...') );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vCaMU
function name:  (null)
number of ops:  10
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'MyMorse'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_FCALL                                               'var_export'
   26     4        INIT_METHOD_CALL                                         !0, 'decode'
          5        SEND_VAL_EX                                              '-.--+---+..-+++...+....+.-+.-..+.-..+++-.+---+-+++.--.+.-+...+...'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
   25     8        DO_ICALL                                                 
   27     9      > RETURN                                                   1

Class MyMorse:
Function decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vCaMU
function name:  decode
number of ops:  11
compiled vars:  !0 = $morseCode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'strtr'
          2        SEND_VAR                                                 !0
          3        FETCH_OBJ_R                                      ~1      'plainTextsByMorseCode'
          4        ADD                                              ~2      ~1, <array>
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        VERIFY_RETURN_TYPE                                       $3
          8      > RETURN                                                   $3
   21     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function decode

End of class MyMorse.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.72 ms | 1014 KiB | 15 Q