CodeIgniter Forums
Number Sorting - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Number Sorting (/thread-70043.html)



Number Sorting - wolfgang1983 - 02-11-2018

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]);
 } 



RE: Number Sorting - InsiteFX - 02-12-2018

Maybe this:

PHP NET - list


RE: Number Sorting - SomeGuy - 04-06-2018

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.


RE: Number Sorting - sitesazan2321 - 04-06-2018

(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?