Jump to content
php.lv forumi

problema ar font_size reizinasanu


Faks

Recommended Posts

$u = array('1','5','15','15','30','55','74','95','99','61');
 for($b = 0; $b < count($u); $b++)
{
$font_size = 10 + $b * 4;
echo '<span style="font-size: '.$font_size.'px">'.$b.'</span>';
echo  '<br>'.$u[rand(0,10)];
}

Problema ir sekojosa iekava for ir $b vins nosaka izmeru prieks fonta kurs tiek reizinats bet problema tami ka vins izvada vinu bet man ir nepieciemas random skaitlu izmeru reizinasa pec vina lieluma isak runajot vins izvada no iekavas for bet man ir nepieciesams lai apstradatu rand pie echo dalas .

Link to comment
Share on other sites

varbūt Tevi nesapratu, bet http://lv.php.net/manual/en/function.array-rand.php

Ja masīvā ir 10 elementi, tad mt_rand(0,9); nevis 0,10 ((:

parparati manu labo domu ideja tami lai random cipari augtu ar reizinajumu katrts nakosais lielaiks savadak vins tikai no for cikla izvelkt ara :D .

panem kodu un apluko kas notiek :D .

Link to comment
Share on other sites

Joprojām neko nesaprotu, ko gribi izdarīt.

Bet ja katru nākamo reizi gribi lielāku randomu, tad pieglabā iepriekšējā vērtību un nākamo randomu sāc no tās.

http://95.68.85.94/L_02_cikli.php

seit ir piemers ko es velos izdarit ar rand katru ciparu .

for cikls man tiek reizinas ar izmeru lieta tami tada veida katrs nakosais cipara Izmers klust lielaks bet problema tami ka man ir nepieciesams lai uz rand dalas tiesi si pati lieta tiktu darita ceru ka kads man palidzes .

Edited by Faks
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...