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

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

using file_get_contents??
okay how would i create a script using file_get_contents() in php have it grab search pages 1-20 and

having probem inserting data into db table
hi

i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute

Error in write byte array into document in SM58
Hi Gurus,

Getting the following error status in Transactional RFC (SM58) ..... *Error i

parameter passing issue on function
Well I thought I had created a pretty slick web page, using ?page and $_GET to load pages which wher

need help modifying script
Hi guys,

I'm fairly new to php and am having a bit of trouble modifying a script.

This

Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?

rand() function
just a general question guys a girls, is the rand() function 100% random or is it based on time?

Help to integrate whois Domain Details to website
Hi,

can i know is their any php script r methods to add domain details to my website.

Word Trimming
Hi Guys & Gals!!

Hope you are all ok....

I need some help with the following

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