Structs data type in php?

后端 未结 7 1479
悲哀的现实
悲哀的现实 2020-12-07 17:47

Can anyone give me example for structs data type in php ? How come there is something like structs in php all of a sudden ?

7条回答
  •  余生分开走
    2020-12-07 17:59

    You can use an array

    $something = array(
       'key' => 'value',
       'key2' => 'value2'
    );
    

    or with standard object.

    $something = new StdClass();
    
    $something->key = 'value';
    $something->key2 = 'value2';
    

提交回复
热议问题