Structs data type in php?
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.
You can use an array
$something = array(
'key' => 'value',
'key2' => 'value2'
);
or with standard object.
$something = new StdClass();
$something->key = 'value';
$something->key2 = 'value2';
I recommend 2 things. First is associative array.
$person = Array();
$person['name'] = "Joe";
$person['age'] = 22;
Second is classes.
Detailed documentation here: http://php.net/manual/en/language.oop5.php