Need some ideas as to how to go about sorting this array...


Posted on 16th Feb 2014 07:03 pm by admin

Here's how the array's are created..

Code: <?php
while ($x = readdir($dp)) {
$order[] = $p['order'];
$files[] = $x;
}
?>

Here's a sample of how they come out..

Code: Array
(
[0] => c
[1] => f
[2] => a
[3] => b
[4] => d
[5] => b
[6] =>
[7] => e
)

Array
(
[0] => learn-more
[1] => apple.php
[2] => company-info
[3] => zigzag.php
[4] => products-services
[5] => customer-support
[6] => index.php
[7] => service-agreements
)

How could I sort the files array by using the values of the order array and also make index.php always first to get something like so:

Code: Array
(
[0] => index.php
[1] => company-info
[2] => zigzag.php
[3] => customer-support
[4] => learn-more
[5] => products-services
[6] => service-agreements
[7] => apple.php
)

No comments posted yet

Your Answer:

Login to answer
293 Like 29 Dislike
Previous forums Next forums
Other forums

TimeStamp Column Problem...
I'm mad at my self and thinking I'm a little retarded. It just be some one mistake I'm missing here.

LIMIT $start, 10... how to pass last value queried into next page with GET??
Ok I know how to display the first or last 10 results of a query...

$result = mysql_query(&q

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

How to have a log of all the status a VIM document had been ?
Hi guys,

I’m using SAP Invoice Management plugin and the /OPT/VIM_ANALYTICS transa

Displaying data from database into a 2 dimensional table
Good day!

I'm a beginner in PHP and I'm not expecting a full coding for this qestion. I'm jus

please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row

php multiple action on submit
I have a form which says:

<form enctype='multipart/form-data' method='post' action='pr

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0

When using connection method: Cache with live

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash