Get your own PHP server

Cast to Object

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) {
}

When casting to object, most data types converts into an object with one property, named "scalar", with the corresponding value.

NULL values converts to an empty object.