A brainfuck interpreter for PHP
This repository goes along with my blog post: The Brain Is A Muscle.
It also is result of this YouTube video: BrainFuck Implementation In PHP
Install PHP-BrainFuck using Composer
php composer.phar require ircmaxell/php-brain-fuck
<?php
// require_once 'vendor/autoload.php';
use BrainFuck\Language;
$Language = new Language;
$output = $Language->run('++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.');
var_dump($output);
// Output:
/*
array (size=13)
0 => int 72
1 => int 101
2 => int 108
3 => int 108
4 => int 111
5 => int 32
6 => int 87
7 => int 111
8 => int 114
9 => int 108
10 => int 100
11 => int 33
12 => int 10
*/
$output = $Language->run(',+.', array(5));
var_dump($output);
// Output:
/*
array (size=1)
0 => int 6
*/