Zeev Suraski writes:
> >Perhaps I have not explained my position. I don't care whether it
> >outputs the exit status as a string--as long as it sets the error code
> >appropriately *as well*.
>
> AFAIR, this is the way it works now...
>
> Zeev
If that were the case I would expect the last 'echo $?' in this
example to output '5' instead of '0'. But I just sank another couple
of scotches so this could be screwed and I'm not gonna think about it
again till morning. :)
See you then,
Torben
Script started on Wed Dec 19 07:05:56 2001
~/work/php-4.1.0RC3
shanna% cat test-exist-status.php
#!/usr/local/bin/php -q
<?php /* -*- mode: c++; minor-mode: font -*- */
error_reporting(E_ALL);
$version = phpversion();
echo "PHP $version\n";
$zero_foo = 'foo';
$five_foo = '5foo';
echo "\$zero_foo: string: $zero_foo; integer: " . (int) $zero_foo . "\n";
echo "\$five_foo: string: $five_foo; integer: " . (int) $five_foo . "\n";
$argv = $HTTP_SERVER_VARS['argv'];
if (empty($argv[1])) {
$argv[1] = false;
}
switch ($argv[1]) {
case '1':
echo "Exiting with \$sero_foo == $zero_foo...\n";
exit($zero_foo);
break;
case '5':
echo "Exiting with \$five_foo == $five_foo...\n";
exit($five_foo);
break;
default:
echo "Exiting with constant 2...\n";
exit(2);
}
?>
~/work/php-4.1.0RC3
shanna% ./test-exist-status.php 1
PHP 4.1.0RC3
$zero_foo: string: foo; integer: 0
$five_foo: string: 5foo; integer: 5
Exiting with constant 2...
2
~/work/php-4.1.0RC3
shanna% echo $?
2
~/work/php-4.1.0RC3
shanna% echo $?./test-exist-status.php 1
PHP 4.1.0RC3
$zero_foo: string: foo; integer: 0
$five_foo: string: 5foo; integer: 5
Exiting with $sero_foo == foo...
foo
~/work/php-4.1.0RC3
shanna% echo $?
0
~/work/php-4.1.0RC3
shanna% ./test-exist-status.php 5
PHP 4.1.0RC3
$zero_foo: string: foo; integer: 0
$five_foo: string: 5foo; integer: 5
Exiting with $five_foo == 5foo...
5foo
~/work/php-4.1.0RC3
shanna% echo $?
0
~/work/php-4.1.0RC3
shanna% exit
Script done on Wed Dec 19 07:06:16 2001
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]