Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More on sorting

Status
Not open for further replies.

Siberdude

Programmer
Apr 4, 2000
29
GB
Can anyone tell me if this:
Code:
$sortby[200110241052] = $stuff[0];
$sortby[200110240935] = $stuff[1];
$sortby[200110252342] = $stuff[2];

foreach ($sortby, $i++)
{
print &quot;<tr><td>$sortby[$i]</td></tr>&quot;;
}

would work? would i get a million and one <td>'s? or would it only enter the loop with when there was something in the slot?

cheers


Siberdude
siberdude@settlers.co.uk
 
it would depend what you initialise i to. if you leave it at 0, you will get millions of rows. if you set it to the index of the first element in the array that u want to continue from, then it wont.

what are u trying to do? if your reading sequentially from one array i.e. stuff, why can't you wrtie sequentially to another i.e. sortby??

$sortby = $stuff;
 
I don't think that will do what you want to do, whatever that is. What is it you're trying to accomplish?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top