Well, it's not PHP command line, it's Unix command line. So you'd be executing code like:
$command = 'im = gdImageCreate(100, 100);
gdImageDestroy(im);'
$command = escapeshellarg(escapeshellcmd($command));
$image = shell_exec($command);
Something like that is how you'd use the command line. I can't guarantee it 100%, but that's the basics (I believe).
~Brett