If we want to instantiate a single object-on-fly we use an anonymous class. Let us discuss a situation, where it could be reasonable to instantiate more than one object from a single anonymous class.

function a(){return new class {};}
$twin1 = a();
$twin2 = a();

Brainfuck is a Turing-complete language. In other words, you can write any possible program using Brainfuck :) And we will write “Hello, world!”, or rather several;)

Brainfuck consists of only 8 commands:

'>' — move to the next
'<' — move to the previous
'+' — increase the value
'—' — decrease the value
'[' — if the value is zero, go to the next to ']'
']' — if the value is non-zero, go to the next to '['
. (point) — outline the value
, (comma) — enter/save a value

Let's write our first Brainfuck program that will display the text “Hello World!”. The algorithm is simple:

  1. Increase the value in the cell until it is equal to the desired character.
  2. Display the value of symbol in the cell
  3. Go to the next cell.
  4. Repeat until all characters are displayed.
function HelloBrainfuck($text): string {
  $length = strlen($text); $a = "";
  for ($i=0;$i<$length;$i++){
    $curr = ord($text[$i]);
    for ($j=1;$j<=$curr;$j++){
      $a .= "+";
      if ($j == $curr & $i != $length-1){
        $a .= ".>";
      }elseif ($j == $curr){
        $a .= ".";
  return $a;