printJimy
-
Posts
11 -
Joined
-
Last visited
Posts posted by printJimy
-
-
why not to be used , they are simple 2 digits ?
-
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 .
-
ok ok, I will not use never again "for or while" .
Thank to all of you , topic can be closed .
-
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] }
-
And would you knock screws in with a hammer, or do the sensible thing and use a screwdriver?
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.
-
Read up on foreach (), and you'll see.
Also,
key ()
isn't a special function in any way, it's been a part of the core PHP functionality since at least 4.x. Granted, it's not often used asforeach ()
is often the better alternative.i know with foreach ,
foreach ($vegetables as $k => $v) { echo $k; }
, but i want with "for" .
-
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
-
I'm just learning how to use" for or while" in these situations .
again , thank you too much.
-
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>"; } ?>
-
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.
New To Php
in PHP Installation and Configuration
Posted
learn first , then works