I need to return a key value pair from a function. It would be preferable to retain the structure of the data. I would like to avoid creating an array with only one value if possible as I do not care for the syntax key($result[0]) or an array with two values, as I would like something with a syntax or structure that suggests the key=>value relationship between the values. Is there a more elegant alternative to the array for returning multiple values from a function in php?
I need to return a key value pair from a function. It would be
Share
How about:
Although I must say, this sounds like a bizarrely specific and largely cosmetic requirement…