Lord Posted March 10, 2011 Report Share Posted March 10, 2011 Sveiki, Ir šāda padarīšana: $lats = 3; if($lats > 5){ //darbojamies }else{ $lats=$lats+1; } Visiem $lats ir obligāti jāiziet if, nevis else. Kā varētu likt IFam atkārtoties tik reižu, lai iznākums būtu patiess? Paldies! Quote Link to comment Share on other sites More sharing options...
php newbie Posted March 10, 2011 Report Share Posted March 10, 2011 em... izmanto ciklu for vai while Quote Link to comment Share on other sites More sharing options...
wintermute Posted March 11, 2011 Report Share Posted March 11, 2011 par 'while' ciklu: http://php.net/manual/en/control-structures.while.php par 'for' ciklu: http://php.net/manual/en/control-structures.for.php Quote Link to comment Share on other sites More sharing options...
m8t Posted March 11, 2011 Report Share Posted March 11, 2011 Var jau arī rekursiju izveidot, ja tas tev viss ir objektos... Nu jā, šaubos vai programmē OOP. Never mind. Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 11, 2011 Report Share Posted March 11, 2011 $lats = 3; if($lats > 5){ //darbojamies }else{ $lats=$lats+1; } tavu kodu uzreiz var parakstit shaadi if($lats > 5){ // viis notiek } else{ $lats=6; } jo ta ka tas $lats nav masiivs tad nav jegas no cikla Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted March 11, 2011 Report Share Posted March 11, 2011 $lats=max($lats,6); //darbojamies Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.