Jump to content

printJimy

Members
  • Posts

    11
  • Joined

  • Last visited

printJimy's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. learn first , then works
  2. why not to be used , they are simple 2 digits ?
  3. I do not say to leave forum , Now I understood the issue , and i thought not to use a " for " in these situations , not forever(even i said ). I am here to learn, not to oppose .
  4. ok ok, I will not use never again "for or while" . Thank to all of you , topic can be closed .
  5. this is what appears to me , the only thing that I changed is that i add an <br> inside of for loop like this: for($q = 1; $q <= $questions; $q++){//loop through number of questions required echo " <input name='questions[]' type='text' value='question $q' /><br/>\n"; for($opt = 1; $opt <= $choices; $opt++){//loop through number of options required echo " <input name='choice[]' type='text' value='option $opt' /><br/>\n"; } [color=#ff0000] //here [/color] [color=#ff0000] echo "<br>";[/color] }
  6. Ok , i said that im just learning how to use other loop in these case , but i do not use" for or while" when i work with array , because i know that foreach is constructed for that. So i just want to know how to use other loop to manipulate with array.
  7. i know with foreach , foreach ($vegetables as $k => $v) { echo $k; } , but i want with "for" .
  8. also i have a question about how to output the key of array with the for loop . example this is an array and this array have 2 key 1 and 2 , how to output these keys . $vegetables=array (1=>"apples", 2=>"pear"); and the output of this array i like to be (if it is possible) : 1 apples 2 pear without any special function like key(); or something like this . Thanks
  9. I'm just learning how to use" for or while" in these situations . again , thank you too much.
  10. Thank to all of you , i really understood issue now . Also when we have the key of array as a string , we need to use a string also in a loop , example like this ? is it the right ? <?php $mArr = array( "a"=>array(1, "string", 3, 4, 5), "b"=>array(7, 20, 43, 44, 25) ); for ($i="a"; $i<= "b"; $i++) { for ($j=0;$j<count($mArr[$i]); $j++) { echo $mArr[$i][$j]." "; } echo"<br>"; } ?>
  11. Hello . ( explain me plz)How can i output an Multidimensional array with for loop(or while), not with foreach ? example this array $exampleMultidmArr = array ( "nested1" =>array (1,2,3,4,5), "nested2" =>array (7,20,43,44,25), ); Thank You.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.