Welcome Guest, Not a member yet? Register   Sign In
Number Sorting
#1

I have a some code that lets me sort my list of array in to different combinations how ever. 

Instead of refreshing page each time

Is there away to just get a printed list of all the different combinations?



PHP Code:
$my_array = array('1''5''8');

 for (
$i 0$i <3$i++) {
 
  
    $random 
array_rand($my_array);  # one random array element number
 
   
    $get_it 
$my_array[$random];    # get the letter from the array
 
   
    echo $get_it
;

 
   unset($my_array[$random]);
 } 
Reply
#2

Maybe this:

PHP NET - list
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 04-06-2018, 12:09 AM by SomeGuy.)

Sounds like the appropriate solution is to:

1. Write a method for each sort (so it can be called on PHP page build AND via JS XHR [code duplication = bad]);
2. Build the form as you have to refresh the page for each sort option;
3. *Enhance* the page using JavaScript that, when available, calls for the sorted data via XHR when requested.

This assumes you care about scale, maybe your data store isn't/won't be that large.
Reply
#4

(04-06-2018, 12:08 AM)SomeGuy Wrote: Sounds like the appropriate solution is to:

1. Write a method for each sort (so it can be called on PHP page build AND via JS XHR [code duplication = bad]);
2. Build the form as you have to refresh the page for each sort option;
3. *Enhance* the page using JavaScript that, when available, calls for the sorted data via XHR when requested.

This assumes you care about scale, maybe your data store isn't/won't be that large.

Hi,
First thank you for the algorithm. Can you give an example?
I'm new to programming and I want to do a lotyk. Do you know the website you introduce me to practice online?
English only
Reply




Theme © iAndrew 2016 - Forum software by © MyBB