I am currently working with an array and I need to know how to move an object within that array to the first position, position [0].
I have this
<?php
$extensions = array(
'.com' => array('whois.verisign-grs.com','No match for'),
'.info' => array('whois.afilias.net','NOT FOUND'),
'.net' => array('whois.crsnic.net','No match for'),
'.co.uk' => array('whois.nic.uk','No match'),
'.nl' => array('whois.domain-registry.nl','is free'),
);
?>
Now, when the user chooses a domain from the dropdown, I want the selected TLD to be the first in this array.
For ex.
User chooses the .net domain, the array wil be:
$extensions = array(
'.net' => array('whois.crsnic.net','No match for'),
'.com' => array('whois.verisign-grs.com','No match for'),
'.info' => array('whois.afilias.net','NOT FOUND'),
'.co.uk' => array('whois.nic.uk','No match'),
'.nl' => array('whois.domain-registry.nl','is free'),
);
Merge the nested array into the larger array:
Demo: http://codepad.org/Mi2S9xTg