Jump to content

More Fun with arrays


kreut

Recommended Posts

Hello,

 

I have an array, $solutions, and a separate indexing array, $solution_order.  From the $solution_order array (developed from the $order variable, where each $order variable looks like '0321' or '3021'), I'd like to create a new array $ordered_solutions, which indexes on the values picked from the $solution_order array.  For example, if my $solutions array is (Big, Small, Fat, Skinny) and my $solution_order array is (2,3,1,0), then the final results should be (Fat, Skinny, Small, Big).  I've written down what I have so far.  Any thoughts about how to move this forward would be appreciated.

 

Thanks!

function GetOrder($solution, $wrong1, $wrong2, $wrong3, $order) {
$solutions = array( $solution,
	               $wrong1,
		$wrong2,
	               $wrong3);
$solution_order = array(substr($order,0,1),
		       substr($order,1,1),
		       substr($order,2,1),
		      substr($order,3,1));
$ordered_solutions = array();
	//what do to here??	

		return $ordered_solutions;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.