|
użytkowników online: 65
|
OPINIE UŻYTKOWNIKÓW
|
Porady zamieszczone tutaj przez Darka są pomocne w wielu chwilach. Wielokrotnie tworząc jakiś złożony serwis korzystam z tych porad. Można by tworzyć samemu te skrypty, ale tak naprawdę czy nie lepiej jest wziąć skrypt z tej strony i zmodyfikowac go dla swoich potrzeb? Wprawdzie możemy taki skrypt napisać sami, ale po co, skoro stracimy czas na coś, co ktoś juz napisał, przetestował i może zagwarantować, że działa poprawnie. Któryś raz z rzędu opłacam abonament i nie raz jeszcze opłacę. Kawał dobrej roboty i ogrom wiedzy w jednym miejscu.
Piotr Karamański Design Studio
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
strncasecmp (PHP 4 >= 4.0.2, PHP 5) strncasecmp --
Binary safe case-insensitive string comparison of the first n
characters
Descriptionint strncasecmp ( string str1, string str2, int len )
This function is similar to strcasecmp(), with
the difference that you can specify the (upper limit of the)
number of characters (len) from each
string to be used in the comparison.
Returns < 0 if str1 is less than
str2; > 0 if str1
is greater than str2, and 0 if they are
equal.
See also ereg(),
strcasecmp(),
strcmp(),
substr(),
stristr(), and
strstr().
User Contributed Notesdjdykes
31-Aug-2005 12:43
Hi all,
be aware when comparing strings using the strcmp family. if you write code like this...
if (strncasecmp($string, 'Trudeau', 4))
print "true";
The above code returns 1 which evaluates to boolean 'true'
that statement will always be true... because these functions return 0 only when equal. so a better test would be
if ( (strncasecmp($string, 'Trudeau', 4)) == 0)
print "true";
always test these functions equality with 0
regards
|