PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Screw PHP!

Code:
10 PRINT "HOME"
20 PRINT "SWEET"
10 GOTO 10
If you look closely, you'll see your program will be in an infinite loop without actually outputting anything.

Sorry, I used to grade Pascal assignments in college as a part-time job, so I can't help but look for bugs. :)

Dan East
Dan East wrote:If you look closely, you'll see your program will be in an infinite loop without actually outputting anything.

Sorry, I used to grade Pascal assignments in college as a part-time job, so I can't help but look for bugs. :)

Dan East


Ah. Ahem. In my defence, m'lud, it's been a long time since I used line numbers! ;)
Wait, can't you just use a Basic interpreter and PHP's exec() function to run BAS scripts anyways?

Off the top of my head:

Code:

<?
function runBasFile($bas)
{
$bi = "qb.exe"; // your qbasic interpreter
if(!exec($bi." /run ".$bas, $return))
{
return false;
} else {
foreach($return as $line)
{
echo $line;
}
return true;
}
}
?>


Wouldn't that run fine on a Windows PC using the standard BASIC/QB interpreter, or on a linux/unix using freebasic?
There's really no reason you would do it that way, the way I'm doing it is a normal CGI script.
You really want to trade PHP for CGI?

Eww.