PHP-Frage
- From
- Michael Lestinsky <michael@...>
- Date
Hallo allerseits,
langsam aber kontinuierlich bin ich verzweifeln an PHP. Kann irgendjemand
der Mitleser mir folgendes Verhalten erklären?
michael@zaphod:~> php -v
PHP 4.3.0 (cli) (built: May 15 2003 20:40:44)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
michael@zaphod:~> echo '<?php if ("rk" == 0) echo "Jepp\n"; ?>' | php
Jepp
michael@zaphod:~> echo '<?php if ("rk" == 1) echo "Jepp\n"; ?>' | php
michael@zaphod:~> echo '<?php if ("rk" == true) echo "Jepp\n"; ?>' | php
Jepp
michael@zaphod:~> echo '<?php if (0 == true) echo "Jepp\n"; ?>' | php
michael@zaphod:~>
"rk" ist also gleichzeitig 0 und true, aber 0 ist nicht true?
Irgendwie scheint der ==-Operator für Strings kaputt zu sein, das würde
auch einige andere höchst merkwürdige Effekte, die ich seit einiger Zeit
an PHP beobachte, erklären.
Bye
Michael
--
"Right here the world enjoys Pax Americana. Like it once enjoyed Pax
Romana. That was peace on the terms of the Romans. Now it's peace on the
terms of the Americans."
-- Patrick Robinson, The Shark Mutiny
application/pgp-signature Anhang: stored
Thread
Follow-ups:
- Re: PHP-Frage Robert Schiele <rschiele@...>
- Re: PHP-Frage Alexander Holler <holler@...>
- Re: PHP-Frage Jochen Stärk <jstaerk@...>