Jump to content

two keys in arrays


sarathi

Recommended Posts

I'm not sure if it is possible when creating the array, unless you manually define them to have the same value, but then affecting one won't affect the other.

 

You could do it with a reference though:

<?php
$foo = array(1 => 'bar');
$foo[0] =& $foo[1];

echo "<pre>",print_r($foo),"</pre>";
?>

 

EDIT: Beaten to it.

Link to comment
https://forums.phpfreaks.com/topic/167814-two-keys-in-arrays/#findComment-885052
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.