Jump to content
php.lv forumi

Function


euphoric

Recommended Posts

Eksistē arī vēl eval() variants un vēl daži interesantāki

${$a."_".$i} = substr($input,$i,1);

$myarray = array(); // php semikols aizmirsās :)
do{
 $i++;
 $myarray[$a."_".$i] = substr($input,$i,1);
}while($i <= 4);
extract($myarray);

Edited by marcis
Link to comment
Share on other sites

Ir taču tāda lieta kā masīvi:

function check_captcha($input)
{
 $i = -1;
 $a = array();
 do
 {
   $i++;
   $a[$i] = $input[$i];
 }
 while($i <= 4);
}

check_captcha('1234');

 

Un kamdēļ no stringa jāvelk atsevišķi čari ārā atsevišķos mainīgos? Lieto $input[4] sintaksi, kur 4 ir indekss stringā.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...