#! /usr/bin/php
<?php
echo <<<INTRO
PHP Command 0.1 Created by Hugo Vacher (korri.fr)

Code is interpreted when line end with ';' or '}' and that all '{' are closed.

You are free to use, modify and redistribute this code, please leave me a comment if you use it.

INTRO;
    while(
true){
        
$texte '';
        
$continue true;
        while(
$continue){
            echo 
'php>';
            
$line trim(fgets(STDIN));
            
$texte .= $line;

                        if(
substr($line,-1)==';' || substr($line,-1)=='}'){
                            
$cnto substr_count($texte'{');
                            
$cntc substr_count($texte'}');

                            if(
$cntc >= $cnto){
                                
$continue false;
                            }
                        }
        }
        eval(
$texte);
    }
?>