3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* braille.php Author(s): *** holdoffhunger (2022 release) (new documentation in English) *** wimulkeman (2013 release) (all documentation was in Dutch) */ class BrailleHandler { /** * Het braille alfabet * De verdeling van de punten ten opzichte van de 0/1 notatie is bij bijvoorbeeld * de n is: * Braille: Nummering: Bitnotatie: * o o 32 16 = 56 110110 * - o 8 4 * o - 2 1 * * @var array * @access public */ public $brailleAlphabet = [ 'a' => '⠁', 'b' => '⠃', 'c' => '⠉', 'd' => '⠙', 'e' => '⠑', 'f' => '⠋', 'g' => '⠛', 'h' => '⠓', 'i' => '⠊', 'j' => '⠚', 'k' => '⠅', 'l' => '⠇', 'm' => '⠍', 'n' => '⠝', 'o' => '⠕', 'p' => '⠏', 'q' => '⠟', 'r' => '⠗', 's' => '⠎', 't' => '⠞', 'u' => '⠥', 'v' => '⠧', 'w' => '⠺', 'x' => '⠭', 'y' => '⠽', 'z' => '⠵', ]; public $brailleAsciiAlphabet = [ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G', 'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K', 'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O', 'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S', 't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W', 'x' => 'X', 'y' => 'Y', 'z' => 'Z', ]; public $brailleBinaryAlphabet = [ 'a' => '100000', 'b' => '101000', 'c' => '110000', 'd' => '110100', 'e' => '100100', 'f' => '111000', 'g' => '111100', 'h' => '101100', 'i' => '011000', 'j' => '011100', 'k' => '100010', 'l' => '101010', 'm' => '110010', 'n' => '110110', 'o' => '100110', 'p' => '111010', 'q' => '111110', 'r' => '101110', 's' => '011010', 't' => '011110', 'u' => '100011', 'v' => '101011', 'w' => '011101', 'x' => '110011', 'y' => '110111', 'z' => '100111', ]; /** * De braille nummering * Voor de verdeling, zie het braille alfabet * * @var array * @access public */ public $brailleIntegers = [ 0 => '⠚', 1 => '⠁', 2 => '⠃', 3 => '⠉', 4 => '⠙', 5 => '⠑', 6 => '⠋', 7 => '⠛', 8 => '⠓', 9 => '⠊', ]; public $brailleAsciiIntegers = [ 1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e', 6 => 'f', 7 => 'g', 8 => 'h', 9 => 'i', 0 => 'j', ]; public $brailleBinaryIntegers = [ 0 => '011100', 1 => '100000', 2 => '101000', 3 => '110000', 4 => '110100', 5 => '100100', 6 => '111000', 7 => '111100', 8 => '101100', 9 => '011000', ]; /** * Speciale tekens in braille * Voor de verdeling, zie het braille alfabet * * @var array * @access public */ public $brailleSpecialCharacters = [ 'capital' => '⠠', 'integer' => '⠼', ',' => '⠂', ';' => '⠆', ':' => '⠒', '.' => '⠲', '?' => '⠦', '!' => '⠖', '"' => '⠶', // Double quotes '(' => '⠐⠣', '[' => '⠐⠣', '*' => '⡠', ')' => '⠐⠜', ']' => '⠐⠜', '\'' => '⡀', // Single quote '’' => '⡀', '-' => '⠤', '—' => '⠤', '/' => '⠸⠌', '\\' => '⠸⠡', ]; public $brailleAsciiSpecialCharacters = [ 'capital' => ',', 'integer' => '#', ',' => '1', ';' => '2', ':' => '3', '.' => '4', '?' => '8', '!' => '6', '"' => '0', // Double quotes '(' => '7', '*' => '"9', ')' => '7', '\'' => '\'', // Single quote '’' => '\'', '-' => '-', '—' => '-', '/' => '_/', '\\' => '_*', '#' => '_?', '$' => '@s', '%' => '.0', '&' => '@&', '+' => '"4', '<' => '@<', '>' => '@>', '=' => '"7', '@' => '@a', '[' => '.<', ']' => '.>', '^' => '@5', '_' => '.-', '`' => '^*', '{' => '_<', '}' => '_>', '~' => '@9', ]; public $brailleBinarySpecialCharacters = [ 'capital' => '000001', 'integer' => '010111', ',' => '001000', ';' => '001010', ':' => '001100', '.' => '001101', '?' => '001011', '!' => '001110', '"' => '001111', // Double quotes '(' => '000100101001', '[' => '000100101001', '*' => '000110', ')' => '000100010110', ']' => '000100010110', '\'' => '000010', // Single quote '’' => '000010', // Single quote '-' => '000011', '/' => '010101010010', '\\' => '010101100001', ]; /** * In deze variabele zal de instantie van deze class worden opgeslagen * * @var object */ private static $_instanceOfMe; /** * De construct van deze class is private om te voorkomen dat hij van buitenaf * aangeroepen kan worden * * @return void * @access private * @author WIM */ public function __construct($args) { $this->mode = $args['mode']; # can be "binary", "dots", or "ascii" $this->errors = []; return $this; } /** * Deze functie moet aangeroepen worden om een instantie van deze class te kunnen * verkrijgen * * @return object Een instantie van deze class * @access public * @author WIM */ public static function init() { // Controleer of de class al geiniteerd is door een andere aanroep if (empty(self::$_instanceOfMe)) { self::$_instanceOfMe = new self(); } // Geef een initiatie van de class terug return self::$_instanceOfMe; } /** * Zet een stuk tekst om naar braille * * @param string $text Het stuk tekst dat omgezet moet worden * * @return string De braille weergave voor de tekst * @access array * @author WIM */ public function convertText($text) { // Het eindresultaat $output = []; // Haal eerst alle paragrafen uit de tekst $paragraphs = explode("\n", $text); // Loop door de paragrafen heen en zet deze om foreach ($paragraphs as $paragraph) { // Kijk of er sprake is van een break punt if (empty($paragraph)) { $output[] = [ 'braille'=>"\n", ]; continue; } $braille = $this->convertParagraph($paragraph); // Plaats na elk stuk weer een enter om de explode werking op te heffen $braille[] = [ 'braille'=>"\n", ]; $output = array_merge($output, $braille); } return $output; } /** * Zet een paragraaf om naar braille * * @param string $paragraph De paragraaf die omgezet moet worden * * @return string De braille weergave voor de paragraaf * @access array * @author WIM */ public function convertParagraph($paragraph) { return $this->convertSentence($paragraph); } /** * Zet een zin om naar braille * * @param string $sentence De zin die omgezet moet worden * * @return array De braille weergave voor de zin * @access array * @author WIM */ public function convertSentence($sentence) { // Het eindresultaat $output = []; // Haal eerst alle woorden uit de tekst $words = explode(" ", $sentence); if($this->mode === 'binary') { $space = '(space)'; } else { $space = ' '; } // Loop door de woorden heen en zet deze om foreach ($words as $word) { // Kijk of er sprake is van een break punt if (empty($word)) { $output[] = [ 'braille'=>$space, ]; continue; } $output[] = $this->convertWord($word); // Plaats na elk stuk weer een spatie om de explode werking op te heffen $output[] = [ 'braille'=>$space, ]; } return $output; } /** * Zet een woord om naar braille * * @param string $word Het woord dat omgezet moet worden * * @return array De braille weergave voor het woord * @access array * @author WIM */ public function convertWord($word) { // De geformateerde braille string $braille = ''; // Geeft aan of een bepaalde indicator wordt toegevoegd $indicatorAdded = false; $indicator = ''; // Kijk of het woord alleen cijfers is if (preg_match('/^[0-9]+$/', $word)) { $indicatorAdded = true; if($this->mode === 'binary') { $indicator = $this->brailleBinarySpecialCharacters['integer']; } elseif($this->mode === 'ascii') { $indicator = $this->brailleAsciiSpecialCharacters['integer']; } else { $indicator = $this->brailleSpecialCharacters['integer']; } } // Zet het woord per karakter om for ($i = 0; $i < strlen($word); ++ $i) { if(($i + 1) < strlen($word)) { $next_letter = $word[$i + 1]; } else { $next_letter = ''; } if(($i + 2) < strlen($word)) { $third_letter = $word[$i + 2]; } else { $third_letter = ''; } $braille .= $this->convertCharacter($word[$i], $indicatorAdded, $word, $next_letter, $third_letter); } if($this->mode === 'ascii') { $braille = str_ireplace(array_keys($this->getAsciiReplacements()), array_values($this->getAsciiReplacements()), $braille); } // Geef de uitkomst terug return [ 'text' => $word, 'braille' => $indicator . $braille, ]; } public function getAsciiReplacements() { return [ 'THE'=>'!', 'ED'=>'$', 'SH'=>'%', 'AND'=>'&', 'OF'=>'(', 'WITH'=>')', 'CH'=>'*', 'ING'=>'+', 'ST'=>'/', 'EN'=>'5', 'IN'=>'9', 'WH'=>':', 'GH'=>'<', 'FOR'=>'=', 'AR'=>'>', 'TH'=>'?', 'OW'=>'[', 'OU'=>'\\', 'ER'=>']', ',T,H,E'=>',!', ',E,D'=>',$', ',S,H'=>',%', ',A,N,D'=>',&', ',O,F'=>',(', ',W,I,T,H'=>',)', ',C,H'=>',*', ',I,N,G'=>',+', ',S,T'=>',/', ',E,N'=>',5', ',I,N'=>',9', ',W,H'=>',:', ',G,H'=>',<', ',F,O,R'=>',=', ',A,R'=>',>', ',T,H'=>',?', ',O,W'=>',[', ',O,U'=>',\\', ',E,R'=>',]', ]; } /** * Zet het karakter om naar een braille teken * * @param string $letter De letter die omgezet moet worden * @param boolean $indicatorAdded Geeft aan of al een indicatie teken is toegevoegd * (nummer | hoofdletter) * * @return array De braille weergave voor de letter * @access array * @author WIM */ public function convertCharacter($character, $indicatorAdded = false, $word, $next_letter, $third_letter) { // De geformateerde braille string $braille = ''; if(empty($character)) { return $braille; } // Kijk wat van soort karakter het is // Voor letters if (preg_match('/[a-z]/i', $character)) { // Controleer of het om een hoofdletter gaat en of dit aangegeven moet worden if ($indicatorAdded == false && preg_match('/[A-Z]/', $character)) { if($this->mode === 'binary') { $braille .= $this->brailleBinarySpecialCharacters['capital']; } elseif($this->mode === 'ascii') { $braille .= $this->brailleAsciiSpecialCharacters['capital']; } else { $braille .= $this->brailleSpecialCharacters['capital']; } } $character = strtolower($character); // Zet het letter om naar het alfabet if($this->mode === 'binary') { return $braille . $this->brailleBinaryAlphabet[$character]; } elseif($this->mode === 'ascii') { return $braille . $this->brailleAsciiAlphabet[$character]; } else { return $braille . $this->brailleAlphabet[$character]; } } // Voor getallen if (preg_match('/[0-9]/', $character)) { // Controleer of het om een hoofdletter gaat en of dit aangegeven moet worden if ($indicatorAdded == false) { if($this->mode === 'binary') { $braille .= $this->brailleBinarySpecialCharacters['integer']; } elseif($this->mode === 'ascii') { $braille .= $this->brailleAsciiSpecialCharacters['integer']; } else { $braille .= $this->brailleSpecialCharacters['integer']; } } if($this->mode === 'binary') { return $braille . $this->brailleBinaryIntegers[$character]; } elseif($this->mode === 'ascii') { return $braille . $this->brailleAsciiIntegers[$character]; } else { return $braille . $this->brailleIntegers[$character]; } } // Kijk of het speciale teken omgezet kan worden if($this->mode === 'binary') { $replacement = $this->brailleBinarySpecialCharacters[$character]; } elseif($this->mode === 'ascii') { $replacement = $this->brailleAsciiSpecialCharacters[$character]; } else { $replacement = $this->brailleSpecialCharacters[$character]; } if (strlen($replacement) !== 0) { return $braille . $replacement; } // Als niks kan worden gevonden, Geef dan een foutmelding en retourneer een lege string if($this->validError(['letter'=>$character, 'next_letter'=>$next_letter, 'third_letter'=>$third_letter])) { $this->errors[] = [ 'description'=>'Character: ' . $character . '; Ord: ' . ord($character) . '; Hex: ' . bin2hex($character) . '; MB_ord: ' . mb_ord($character) . '; Ctype: ' . ctype_print($character) . '; Word: ' . $word . '; Next Letter: ' . $next_letter . '; Next-Next Letter: ' . $third_letter . '.', ]; } return $braille; } public function validError($args) { return TRUE; $letter = $args['letter']; $next_letter = $args['next_letter']; if($this->skip_next_error > 0) { $this->skip_next_error--; return FALSE; } switch($letter) { case (ORD($letter) === 226 && ORD($next_letter) === 128 && ORD($next_letter) === 115): # ’ $this->skip_next_error = TRUE; return FALSE; break; } return TRUE; } public function formattedOutput($text) { $result = $this->convertText($text); return implode('', (array_column($result, 'braille'))); } } $brailleHandler2 = new brailleHandler(['mode'=>'dots']); print($brailleHandler2->formattedOutput("We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness.--That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, --That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness."));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tZotT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $brailleHandler2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  604     0  E >   NEW                                              $1      'brailleHandler'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
  606     4        INIT_METHOD_CALL                                         !0, 'formattedOutput'
          5        SEND_VAL_EX                                              'We+hold+these+truths+to+be+self-evident%2C+that+all+men+are+created+equal%2C+that+they+are+endowed+by+their+Creator+with+certain+unalienable+Rights%2C+that+among+these+are+Life%2C+Liberty+and+the+pursuit+of+Happiness.--That+to+secure+these+rights%2C+Governments+are+instituted+among+Men%2C+deriving+their+just+powers+from+the+consent+of+the+governed%2C+--That+whenever+any+Form+of+Government+becomes+destructive+of+these+ends%2C+it+is+the+Right+of+the+People+to+alter+or+to+abolish+it%2C+and+to+institute+new+Government%2C+laying+its+foundation+on+such+principles+and+organizing+its+powers+in+such+form%2C+as+to+them+shall+seem+most+likely+to+effect+their+Safety+and+Happiness.'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Class BrailleHandler:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tZotT
function name:  __construct
number of ops:  9
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  267     0  E >   RECV                                             !0      
  268     1        FETCH_DIM_R                                      ~2      !0, 'mode'
          2        ASSIGN_OBJ                                               'mode'
          3        OP_DATA                                                  ~2
  270     4        ASSIGN_OBJ                                               'errors'
          5        OP_DATA                                                  <array>
  272     6        FETCH_THIS                                       ~4      
          7      > RETURN                                                   ~4
  273     8*     > RETURN                                                   null

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/tZotT
function name:  init
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  285     0  E >   ISSET_ISEMPTY_STATIC_PROP                                '_instanceOfMe'
          1      > JMPZ                                                     ~0, ->6
  286     2    >   NEW                          self                $2      
          3        DO_FCALL                                      0          
          4        ASSIGN_STATIC_PROP                                       '_instanceOfMe'
          5        OP_DATA                                                  $2
  290     6    >   FETCH_STATIC_PROP_R          unknown             ~4      '_instanceOfMe'
          7      > RETURN                                                   ~4
  291     8*     > RETURN                                                   null

End of function init

Function converttext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/tZotT
function name:  convertText
number of ops:  29
compiled vars:  !0 = $text, !1 = $output, !2 = $paragraphs, !3 = $paragraph, !4 = $braille
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  302     0  E >   RECV                                             !0      
  304     1        ASSIGN                                                   !1, <array>
  307     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
  310     7      > FE_RESET_R                                       $8      !2, ->26
          8    > > FE_FETCH_R                                               $8, !3, ->26
  312     9    >   ISSET_ISEMPTY_CV                                         !3
         10      > JMPZ                                                     ~9, ->14
  313    11    >   ASSIGN_DIM                                               !1
  314    12        OP_DATA                                                  <array>
  316    13      > JMP                                                      ->8
  319    14    >   INIT_METHOD_CALL                                         'convertParagraph'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0  $11     
         17        ASSIGN                                                   !4, $11
  321    18        ASSIGN_DIM                                               !4
  322    19        OP_DATA                                                  <array>
  324    20        INIT_FCALL                                               'array_merge'
         21        SEND_VAR                                                 !1
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !1, $14
  310    25      > JMP                                                      ->8
         26    >   FE_FREE                                                  $8
  327    27      > RETURN                                                   !1
  328    28*     > RETURN                                                   null

End of function converttext

Function convertparagraph:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tZotT
function name:  convertParagraph
number of ops:  6
compiled vars:  !0 = $paragraph
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  339     0  E >   RECV                                             !0      
  340     1        INIT_METHOD_CALL                                         'convertSentence'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  341     5*     > RETURN                                                   null

End of function convertparagraph

Function convertsentence:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
Branch analysis from position: 30
filename:       /in/tZotT
function name:  convertSentence
number of ops:  33
compiled vars:  !0 = $sentence, !1 = $output, !2 = $words, !3 = $space, !4 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  352     0  E >   RECV                                             !0      
  354     1        ASSIGN                                                   !1, <array>
  357     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
  359     7        FETCH_OBJ_R                                      ~8      'mode'
          8        IS_IDENTICAL                                             ~8, 'binary'
          9      > JMPZ                                                     ~9, ->12
  360    10    >   ASSIGN                                                   !3, '%28space%29'
  359    11      > JMP                                                      ->13
  362    12    >   ASSIGN                                                   !3, '+'
  366    13    > > FE_RESET_R                                       $12     !2, ->30
         14    > > FE_FETCH_R                                               $12, !4, ->30
  368    15    >   ISSET_ISEMPTY_CV                                         !4
         16      > JMPZ                                                     ~13, ->21
  370    17    >   INIT_ARRAY                                       ~15     !3, 'braille'
  369    18        ASSIGN_DIM                                               !1
  370    19        OP_DATA                                                  ~15
  372    20      > JMP                                                      ->14
  375    21    >   INIT_METHOD_CALL                                         'convertWord'
         22        SEND_VAR_EX                                              !4
         23        DO_FCALL                                      0  $17     
         24        ASSIGN_DIM                                               !1
         25        OP_DATA                                                  $17
  378    26        INIT_ARRAY                                       ~19     !3, 'braille'
  377    27        ASSIGN_DIM                                               !1
  378    28        OP_DATA                                                  ~19
  366    29      > JMP                                                      ->14
         30    >   FE_FREE                                                  $12
  382    31      > RETURN                                                   !1
  383    32*     > RETURN                                                   null

End of function convertsentence

Function convertword:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 29
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 80
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 80
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 37
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 46
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 29
Branch analysis from position: 61
Branch analysis from position: 29
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 29
Branch analysis from position: 61
Branch analysis from position: 29
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 46
Branch analysis from position: 42
Branch analysis from position: 46
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 27
filename:       /in/tZotT
function name:  convertWord
number of ops:  85
compiled vars:  !0 = $word, !1 = $braille, !2 = $indicatorAdded, !3 = $indicator, !4 = $i, !5 = $next_letter, !6 = $third_letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  394     0  E >   RECV                                             !0      
  396     1        ASSIGN                                                   !1, ''
  399     2        ASSIGN                                                   !2, <false>
  400     3        ASSIGN                                                   !3, ''
  403     4        INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%5E%5B0-9%5D%2B%24%2F'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $10     
          8      > JMPZ                                                     $10, ->27
  404     9    >   ASSIGN                                                   !2, <true>
  405    10        FETCH_OBJ_R                                      ~12     'mode'
         11        IS_IDENTICAL                                             ~12, 'binary'
         12      > JMPZ                                                     ~13, ->17
  406    13    >   FETCH_OBJ_R                                      ~14     'brailleBinarySpecialCharacters'
         14        FETCH_DIM_R                                      ~15     ~14, 'integer'
         15        ASSIGN                                                   !3, ~15
  405    16      > JMP                                                      ->27
  407    17    >   FETCH_OBJ_R                                      ~17     'mode'
         18        IS_IDENTICAL                                             ~17, 'ascii'
         19      > JMPZ                                                     ~18, ->24
  408    20    >   FETCH_OBJ_R                                      ~19     'brailleAsciiSpecialCharacters'
         21        FETCH_DIM_R                                      ~20     ~19, 'integer'
         22        ASSIGN                                                   !3, ~20
  407    23      > JMP                                                      ->27
  410    24    >   FETCH_OBJ_R                                      ~22     'brailleSpecialCharacters'
         25        FETCH_DIM_R                                      ~23     ~22, 'integer'
         26        ASSIGN                                                   !3, ~23
  415    27    >   ASSIGN                                                   !4, 0
         28      > JMP                                                      ->58
  416    29    >   ADD                                              ~26     !4, 1
         30        STRLEN                                           ~27     !0
         31        IS_SMALLER                                               ~26, ~27
         32      > JMPZ                                                     ~28, ->37
  417    33    >   ADD                                              ~29     !4, 1
         34        FETCH_DIM_R                                      ~30     !0, ~29
         35        ASSIGN                                                   !5, ~30
  416    36      > JMP                                                      ->38
  419    37    >   ASSIGN                                                   !5, ''
  422    38    >   ADD                                              ~33     !4, 2
         39        STRLEN                                           ~34     !0
         40        IS_SMALLER                                               ~33, ~34
         41      > JMPZ                                                     ~35, ->46
  423    42    >   ADD                                              ~36     !4, 2
         43        FETCH_DIM_R                                      ~37     !0, ~36
         44        ASSIGN                                                   !6, ~37
  422    45      > JMP                                                      ->47
  425    46    >   ASSIGN                                                   !6, ''
  428    47    >   INIT_METHOD_CALL                                         'convertCharacter'
         48        CHECK_FUNC_ARG                                           
         49        FETCH_DIM_FUNC_ARG                               $40     !0, !4
         50        SEND_FUNC_ARG                                            $40
         51        SEND_VAR_EX                                              !2
         52        SEND_VAR_EX                                              !0
         53        SEND_VAR_EX                                              !5
         54        SEND_VAR_EX                                              !6
         55        DO_FCALL                                      0  $41     
         56        ASSIGN_OP                                     8          !1, $41
  415    57        PRE_INC                                                  !4
         58    >   STRLEN                                           ~44     !0
         59        IS_SMALLER                                               !4, ~44
         60      > JMPNZ                                                    ~45, ->29
  431    61    >   FETCH_OBJ_R                                      ~46     'mode'
         62        IS_IDENTICAL                                             ~46, 'ascii'
         63      > JMPZ                                                     ~47, ->80
  432    64    >   INIT_FCALL                                               'str_ireplace'
         65        INIT_FCALL                                               'array_keys'
         66        INIT_METHOD_CALL                                         'getAsciiReplacements'
         67        DO_FCALL                                      0  $48     
         68        SEND_VAR                                                 $48
         69        DO_ICALL                                         $49     
         70        SEND_VAR                                                 $49
         71        INIT_FCALL                                               'array_values'
         72        INIT_METHOD_CALL                                         'getAsciiReplacements'
         73        DO_FCALL                                      0  $50     
         74        SEND_VAR                                                 $50
         75        DO_ICALL                                         $51     
         76        SEND_VAR                                                 $51
         77        SEND_VAR                                                 !1
         78        DO_ICALL                                         $52     
         79        ASSIGN                                                   !1, $52
  437    80    >   INIT_ARRAY                                       ~54     !0, 'text'
  438    81        CONCAT                                           ~55     !3, !1
         82        ADD_ARRAY_ELEMENT                                ~54     ~55, 'braille'
         83      > RETURN                                                   ~54
  440    84*     > RETURN                                                   null

End of function convertword

Function getasciireplacements:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tZotT
function name:  getAsciiReplacements
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  444     0  E > > RETURN                                                   <array>
  484     1*     > RETURN                                                   null

End of function getasciireplacements

Function convertcharacter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 63
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 39
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 51
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 59
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 51
Branch analysis from position: 46
Branch analysis from position: 51
Branch analysis from position: 39
Branch analysis from position: 21
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 107
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 87
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 77
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 95
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 98, Position 2 = 103
Branch analysis from position: 98
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 103
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 84
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 95
Branch analysis from position: 90
Branch analysis from position: 95
Branch analysis from position: 87
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 114
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
2 jumps found. (Code = 43) Position 1 = 127, Position 2 = 129
Branch analysis from position: 127
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 129
2 jumps found. (Code = 43) Position 1 = 136, Position 2 = 168
Branch analysis from position: 136
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 168
Branch analysis from position: 114
2 jumps found. (Code = 43) Position 1 = 117, Position 2 = 121
Branch analysis from position: 117
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 121
2 jumps found. (Code = 43) Position 1 = 127, Position 2 = 129
Branch analysis from position: 127
Branch analysis from position: 129
filename:       /in/tZotT
function name:  convertCharacter
number of ops:  170
compiled vars:  !0 = $character, !1 = $indicatorAdded, !2 = $word, !3 = $next_letter, !4 = $third_letter, !5 = $braille, !6 = $replacement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  497     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
  499     5        ASSIGN                                                   !5, ''
  501     6        ISSET_ISEMPTY_CV                                         !0
          7      > JMPZ                                                     ~8, ->9
  502     8    > > RETURN                                                   !5
  507     9    >   INIT_FCALL                                               'preg_match'
         10        SEND_VAL                                                 '%2F%5Ba-z%5D%2Fi'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->63
  509    14    >   BOOL_NOT                                         ~10     !1
         15      > JMPZ_EX                                          ~10     ~10, ->21
         16    >   INIT_FCALL                                               'preg_match'
         17        SEND_VAL                                                 '%2F%5BA-Z%5D%2F'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $11     
         20        BOOL                                             ~10     $11
         21    > > JMPZ                                                     ~10, ->39
  510    22    >   FETCH_OBJ_R                                      ~12     'mode'
         23        IS_IDENTICAL                                             ~12, 'binary'
         24      > JMPZ                                                     ~13, ->29
  511    25    >   FETCH_OBJ_R                                      ~14     'brailleBinarySpecialCharacters'
         26        FETCH_DIM_R                                      ~15     ~14, 'capital'
         27        ASSIGN_OP                                     8          !5, ~15
  510    28      > JMP                                                      ->39
  512    29    >   FETCH_OBJ_R                                      ~17     'mode'
         30        IS_IDENTICAL                                             ~17, 'ascii'
         31      > JMPZ                                                     ~18, ->36
  513    32    >   FETCH_OBJ_R                                      ~19     'brailleAsciiSpecialCharacters'
         33        FETCH_DIM_R                                      ~20     ~19, 'capital'
         34        ASSIGN_OP                                     8          !5, ~20
  512    35      > JMP                                                      ->39
  515    36    >   FETCH_OBJ_R                                      ~22     'brailleSpecialCharacters'
         37        FETCH_DIM_R                                      ~23     ~22, 'capital'
         38        ASSIGN_OP                                     8          !5, ~23
  519    39    >   INIT_FCALL                                               'strtolower'
         40        SEND_VAR                                                 !0
         41        DO_ICALL                                         $25     
         42        ASSIGN                                                   !0, $25
  522    43        FETCH_OBJ_R                                      ~27     'mode'
         44        IS_IDENTICAL                                             ~27, 'binary'
         45      > JMPZ                                                     ~28, ->51
  523    46    >   FETCH_OBJ_R                                      ~29     'brailleBinaryAlphabet'
         47        FETCH_DIM_R                                      ~30     ~29, !0
         48        CONCAT                                           ~31     !5, ~30
         49      > RETURN                                                   ~31
  522    50*       JMP                                                      ->63
  524    51    >   FETCH_OBJ_R                                      ~32     'mode'
         52        IS_IDENTICAL                                             ~32, 'ascii'
         53      > JMPZ                                                     ~33, ->59
  525    54    >   FETCH_OBJ_R                                      ~34     'brailleAsciiAlphabet'
         55        FETCH_DIM_R                                      ~35     ~34, !0
         56        CONCAT                                           ~36     !5, ~35
         57      > RETURN                                                   ~36
  524    58*       JMP                                                      ->63
  527    59    >   FETCH_OBJ_R                                      ~37     'brailleAlphabet'
         60        FETCH_DIM_R                                      ~38     ~37, !0
         61        CONCAT                                           ~39     !5, ~38
         62      > RETURN                                                   ~39
  532    63    >   INIT_FCALL                                               'preg_match'
         64        SEND_VAL                                                 '%2F%5B0-9%5D%2F'
         65        SEND_VAR                                                 !0
         66        DO_ICALL                                         $40     
         67      > JMPZ                                                     $40, ->107
  534    68    >   BOOL_NOT                                         ~41     !1
         69      > JMPZ                                                     ~41, ->87
  535    70    >   FETCH_OBJ_R                                      ~42     'mode'
         71        I

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.74 ms | 1050 KiB | 20 Q