devWhiz Posted April 6, 2012 Share Posted April 6, 2012 Honestly, for something like this I don't know how to go about creating this script.. So I want to create a script that will generate every combination of 2 numbers that range from 0-749, so 750x750 = 562500 possible combinations, so for example, 0/749, 43/87, 0/0, 1/1, 2/1, 1/2, 500/450, 405/673, etc.. How would I go about starting to write a script that can generate all of the possible combinations and and put them in an array or write them to a file? Thanks for the help in advanced! -CLUEL3SS Link to comment https://forums.phpfreaks.com/topic/260426-help-with-a-script-to-create-every-combination-of-2-numbers/ Share on other sites More sharing options...
Drummin Posted April 6, 2012 Share Posted April 6, 2012 Like this <?php $numbers=array(); $grid=range(0,750); foreach($grid as $ns){ foreach($grid as $ew){ $numbers[]="$ns"."/"."$ew"; } } print_r($numbers); ?> Link to comment https://forums.phpfreaks.com/topic/260426-help-with-a-script-to-create-every-combination-of-2-numbers/#findComment-1334844 Share on other sites More sharing options...
devWhiz Posted April 6, 2012 Author Share Posted April 6, 2012 Not as hard as I figured it would be, thank you! Link to comment https://forums.phpfreaks.com/topic/260426-help-with-a-script-to-create-every-combination-of-2-numbers/#findComment-1334848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.