獲取您 自己的 PHP 伺服器
object(stdClass)#1 (1) {
  ["scalar"]=>
  int(5)
}
object(stdClass)#2 (1) {
  ["scalar"]=>
  float(5.34)
}
object(stdClass)#3 (1) {
  ["scalar"]=>
  string(5) "hello"
}
object(stdClass)#4 (1) {
  ["scalar"]=>
  bool(true)
}
object(stdClass)#5 (0) {
}

轉換為物件時,大多數資料型別會轉換為一個具有單個屬性的物件,該屬性名為“scalar”,其值為對應的值。

NULL 值會轉換為一個空物件。