Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Problem z funkcja substr()
Bojakki
post
Post #1





Grupa: Zarejestrowani
Postów: 379
Pomógł: 0
Dołączył: 18.08.2004

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


Napisalem swoja funkcje:
dla $id =1000

  1. <?php
  2. function urlc($id){
  3. $id0 = sprintf("%03s", $id);
  4. $string = substr("$id0", -3);
  5. $cat1 = substr("$id0", 0, 2);
  6. $cat2 = substr("$id0", -1);
  7. .....
  8. ....
  9. }
  10. ?>

$cat1 poiwnno sie rownac '00', a $cat2 '0'. Podczas gdy mi wyswietla $cat1='10', a $cat2='0'.

Nie mam pojecia dlaczego tak sie dzieje.


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 22.08.2025 - 01:57