rumd3x / php-brainfuck
A nice PHP Utility made out of boredom for encoding a string into brainfuck code and vice-versa.
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 2
Open Issues: 0
pkg:composer/rumd3x/php-brainfuck
Requires
- php: >=5.5
This package is auto-updated.
Last update: 2025-09-25 03:44:32 UTC
README
A nice PHP Utility made out of boredom for encoding a string into brainfuck code and vice-versa.
Installation
To install via composer just run
composer require rumd3x/php-brainfuck
Usage
Encoding
use Rumd3x\Brainfuck\Brainfuck; echo Brainfuck::encode("Hello World!"); // outputs: ++++++++++[>+++++++>++++++++++>+++++++++++>+++++++++++>+++++++++++>+++>+++++++++>+++++++++++>+++++++++++>+++++++++++>++++++++++>+++<<<<<<<<<<<<-]>++.>+.>--.>--.>+.>++.>---.>+.>++++.>--.>.>+++.
There's also a second a third optional parameters for the encoding.
The second is for replacing non-ASCII characters.
And the third is for generating an minified or pretty-printed version of the code.
use Rumd3x\Brainfuck\Brainfuck; echo Brainfuck::encode("Some ASCII: ABC+ŤĎ and some non-ASCII: Ąąśćł.'", true); // will replace non-ascii with their ascii counterpart echo Brainfuck::encode("Prettifying'", false, true); // will output pretty printed brainfuck code
Decoding
use Rumd3x\Brainfuck\Brainfuck; echo Brainfuck::decode("++++++++++[>+++++++>++++++++++>+++++++++++>+++++++++++>+++++++++++>+++>+++++++++>+++++++++++>+++++++++++>+++++++++++>++++++++++>+++<<<<<<<<<<<<-]>++.>+.>--.>--.>+.>++.>---.>+.>++++.>--.>.>+++."); // outputs: Hello World!
Happy brainfucking!