Skip to content
A brainfuck interpreter for PHP
PHP
Latest commit 68c1cc3 Jan 10, 2013 @ircmaxell Merge pull request #1 from EmanueleMinotto/master
Syntactic sugar
Failed to load latest commit information.
lib/BrainFuck moved bootstrap to test Jan 10, 2013
test updated example Jan 10, 2013
.gitignore composer tests Jan 10, 2013
README.md fix Jan 10, 2013
composer.json developers Jan 10, 2013
phpunit.xml.dist phpunit using composer Jan 10, 2013

README.md

PHP-BrainFuck

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

Install PHP-BrainFuck using Composer

php composer.phar require ircmaxell/php-brain-fuck

Usage

<?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
*/
Something went wrong with that request. Please try again.