Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Dziwne zachownie ==
Teamon
post
Post #1





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 18.09.2006

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $value = "string";
  3. if($value == 0) echo 'zero';
  4. ?>


i co dziwne echuje 'zero'

Pytanie, dlaczego?
Go to the top of the page
+Quote Post
ArniPL
post
Post #2





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 19.11.2006

Ostrzeżenie: (0%)
-----


Nie jestem pewny... ale być może dlatego, że $value jest typu string a Ty porównujesz tą zmienną z integerem.
Go to the top of the page
+Quote Post
Łukasz O.
post
Post #3





Grupa: Zarejestrowani
Postów: 191
Pomógł: 5
Dołączył: 13.01.2007

Ostrzeżenie: (0%)
-----


zmienna $value jest konwertowana do int'a i przybiera wartość 0
Go to the top of the page
+Quote Post
Teamon
post
Post #4





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 18.09.2006

Ostrzeżenie: (0%)
-----


Hm, to ma sens (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Dziękować.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 17.10.2025 - 04:46