Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak zmienic Stringa na Integera?, Rzutowanie nie dziala jak powinno
lb_lb
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 21.07.2005

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


O to fragment kodu:
  1. <?php
  2.  
  3. $width = '<script language=\"JavaScript1.2\">document.write(screen.width)</script>';
  4. $height = '<script language=\"JavaScript1.2\">document.write(screen.height)</script>';
  5.  
  6. echo 'Width ' . $width . ' || <BR>';//tuwynikiem jest twoja rozdzialka pozioma
  7. echo 'Height ' . $height . ' ||<br>';//tu pionowa
  8. $x = (Integer)$width;// tu $x wnosi 0
  9. echo &#092;"Razy 2: \" . $x * 2;// tu tez zero
  10. ?>

(IMG:http://forum.php.pl/uwaga.gif) - nospor
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Cudi
post
Post #2


Administrator planeta/IRC


Grupa: Przyjaciele php.pl
Postów: 385
Pomógł: 0
Dołączył: 19.04.2003
Skąd: Zabrze

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


  1. <?php
  2. $i = 5;
  3.  
  4. $s = strval($i);
  5. // lub
  6. $s = &#092;"\" . $i . \"\";
  7. // lub
  8. $s = (string) $i;
  9. // lub
  10. settype($i, 'string');
  11. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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 - 14:50