@gmail.com>
[mailto:fynw...@gmail.com] <mailto:fynw...@gmail.com%5d> *On
Behalf Of *A.J. Brown
*Sent:* Friday, February 06, 2009 12:24 PM
*To:* Zend Framework General
*Subject:* [fw-general] stdClass Question
Hey guys,
This is probabl
-- A.J. Brown wrote
(on Friday, 06 February 2009, 10:24 AM -0700):
> Hey guys,
>
> This is probably more approriate for the PHP list, but I'm not subscribed with
> this email address, so I'll pose it here.
>
> Is there a better / built in way to turn an array into a stdClass?
>
> //TODO (is the
age.oop5.overloading.php#language.oop5.overloading.members
>
> Mike Tramontano
> *eFashion Solutions -* Sr Backend Developer
> mtramont...@efashionsolutions.com
>
>
> *From:* fynw...@gmail.com [mailto:fynw...@gmail.com]
> *On Behalf Of *A.J. Brown
> *Sent:* Friday,
on Solutions - Sr Backend Developer
> mtramont...@efashionsolutions.com
>
>
> From: fynw...@gmail.com [mailto:fynw...@gmail.com] On Behalf Of A.J. Brown
> Sent: Friday, February 06, 2009 12:24 PM
> To: Zend Framework General
> Subject: [fw-general] stdClass Question
>
>
...@ajbrown.org; Zend Framework General
Subject: RE: [fw-general] stdClass Question
What you have there works fine, is simple, and is relatively quick so
I'm not sure why you're looking for something built-in.
That being said, an alternative is to make a class that simply copies
the array to
From: fynw...@gmail.com [mailto:fynw...@gmail.com] On Behalf Of A.J.
Brown
Sent: Friday, February 06, 2009 12:24 PM
To: Zend Framework General
Subject: [fw-general] stdClass Question
Hey guys,
This is probably more approriate for the PHP list, but I'm not
subscribed with this email address,
That's not exactly what I was thinking :) I was hoping there was something
built-in that I was missing :-/
On Fri, Feb 6, 2009 at 10:25 AM, Josh Team wrote:
> function array2Obj($array, $obj = null)
> {
> if (is_null($obj))
> {
> $obj = new stdClass();
> }
>
> foreach (
function array2Obj($array, $obj = null)
{
if (is_null($obj))
{
$obj = new stdClass();
}
foreach ($array as $key => $value)
{
if (is_scalar($value))
{
$obj->$key = $value;
} else if (is_array($value)) {
if (isset($value[0]))
{
Hey guys,
This is probably more approriate for the PHP list, but I'm not subscribed
with this email address, so I'll pose it here.
Is there a better / built in way to turn an array into a stdClass?
//TODO (is there / why isn't there) a built in way to do this?
$oTrack = new stdClass();
foreach(