I want to create a key-value pairs in an array within a foreach. Here is what I have so far:
function createOfferUrlArray($Offer) {
$offerArray = array();
Create key value pairs on the phpsh commandline like this:
php> $keyvalues = array();
php> $keyvalues['foo'] = "bar";
php> $keyvalues['pyramid'] = "power";
php> print_r($keyvalues);
Array
(
[foo] => bar
[pyramid] => power
)
Get the count of key value pairs:
php> echo count($offerarray);
2
Get the keys as an array:
php> echo implode(array_keys($offerarray));
foopyramid