Jump to content

creating a 3rd array out of two


jimfog

Recommended Posts

I have these 2 arrays:

array(5) { [0]=>string(6) "sunday"[1]=> string(6) "monday" [2]=>string(7) "tuesday"[3]=>string(6) "friday"[4]=>  string(8) "saturday"}$hidd_days=[0=>'sunday',1=>'monday',2=>'tuesday',3=>'wednesday',4=>'thursday',5=>'friday',6=>'saturday'];

I want somehow to merge these two arrays but in the following manner:

 

In this 3rd array there will only be the weekdays mentioned in the first array but their keys will be the one corresponding in the second array...such as this:

 

$third_array=[0=>'sunday',1=>'monday',2=>tuesday,5=>friday,6=>'saturday'];

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...