0
0

StdClassの利用例

Last updated at Posted at 2024-05-16

StdClassの利用例

$user->idのような、
オブジェクト型で扱いたい場合に使える

$osaka_count = 1;
$tokyo_count = 2;
$kyoto_count = 3;

$ret = new StdClass();// クラスなのでnewする必要あり

$ret->osaka_count = $osaka_count;
$ret->tokyo_count = $tokyo_count;
$ret->kyoto_count = $kyoto_count;

結果

$ret->osaka_count = 1;
$ret->tokyo_count = 2;
$ret->kyoto_count = 3;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0