Does PHP have a struct data type?

Closest you’d get to a struct is an object with all members public.

class MyStruct {
    public $foo;
    public $bar;
}

$obj = new MyStruct();
$obj->foo = 'Hello';
$obj->bar="World";

I’d say looking at the PHP Class Documentation would be worth it.
If you need a one-off struct, use the StdObject as mentioned in alex’s answer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)