42 :)

Minden út Douglas Adams-hez vezet!

PHP4man_hu.pdf - 1027. oldal:

strspn(PHP 3>= 3.0.3, PHP 4 )

Find length of initial segment matching mask

int strspn (string str1, string str2)

Returns the length of the initial segment of str1 which consists entirely of characters in str2.
The line of code:

$var = strspn ("42 is the answer, what is the question ...", "1234567890");

will assign 2 to $var, because the string "42" will be the longest segment containing characters from "1234567890".

See also strcspn().

Hozzászólások

Van sok helyen még.
pl.: Stoustrup C++ könyévek 216. oldalán


const int answer = 42;

illetve a könyvben is még többször előfordul :-)

PHP Kézikönyv
Stig Sæther Bakken, Alexander Aulbach, Egon Schmid, Jim Winstead, Lars Torben Wilson, Rasmus Lerdorf, Zeev Suraski,
Andrei Zmievski, és Jouni Ahto
Szerkesztette
Stig Sæther Bakken
Egon Schmid
Fordítók:
Hojtsy Gábor
Kontra Gergely
Varanka Zoltán
Másképpen segített:
Jouni Ahto