How to create an object out of array of strings in php
438
I'm new tophp
. I just want to create an object from array of strings.
I want these array of strings:
$arrEmails = [
'[email protected]',
'[email protected]',
'[email protected]'
];
to be put in an object to be accessed like,$emails = $objEmails->email
How is it possible?
Answer
Solution:
Just create your empty object and just simply add that property:
Answer
Solution:
You should have a class like this:
Answer
Solution:
You can also try with -