Autor Zpráva
daop
Profil *
Zdravim,
chci se zeptat, mam array pole, ktere jako prvni znak me urcuje nejakou funkci, ktera se ma se sbytkem stringu provest....
Existuje jednoducha fligna jak toho docilit? Jak dat pozici konkterniho znaku do podminky? Neco jako mam obycejny bezrozmerny string, a v nem pomoci indexu primo vybrat prvni znak, aniz bych pouzival fce na orezavani celeho retezce... Proste neco jako pointer v cecku. V php5....
Mastodont
Profil
$str = 'This is a test.';
$first = $str[0];

http://cz2.php.net/manual/en/language.types.string.php
Kcko
Profil
Lépe $str{0}

s hranatou zavorkou to muze svadet, ze se jedna o pole ...
Mastodont
Profil
Kcko
No vždyť to taky pole je ... pročti si tu stránku, co jsem linkoval:

Characters within strings may be accessed and modified by specifying the zero-based offset of the desired character after the string using square array-brackets like $str[42] so think of a string as an array of characters.

Note: They may also be accessed using braces like $str{42} for the same purpose. However, using square array-brackets is preferred because the {braces} style is deprecated as of PHP 6.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0