Jump to content

array keys matching function


dadamssg

Recommended Posts

Say i have two arrays with custom keys. What would be the easiest way to write a function that would determine if all the keys in arrayOne are in arrayTwo? The example below would return false because keys 3 and 4 are missing in arrayTwo. Any help would be much appreciate. thanks!

 

<?php

$arrayOne['1'] = "adg";
$arrayOne['2'] = "a4g";
$arrayOne['3'] = "346";
$arrayOne['4'] = "etwe";

$arrayTwo['1'] = "xcb";
$arrayTwo['2'] = "acbr";
$arrayTwo['6'] = "yiy";
$arrayTwo['7'] = "mmm";
?>

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.