Skip to content

Instantly share code, notes, and snippets.

@aramirez-es
Created July 25, 2012 20:26
Show Gist options
  • Save aramirez-es/3178450 to your computer and use it in GitHub Desktop.
Save aramirez-es/3178450 to your computer and use it in GitHub Desktop.
<?php
// 1. Testing with a String.
php > var_dump( (object) "Hi Pedro" );
/* OUTPUT:
object(stdClass)#1 (1) {
["scalar"]=>
string(8) "Hi Pedro"
}
*/
// 2. Testing with a Int.
php > var_dump( (object) 1024 );
/* OUTPUT:
object(stdClass)#1 (1) {
["scalar"]=>
int(1024)
}
*/
// 3. Testing String.
php > $test = (object) "Hello";
php > echo $test->scalar;
/* OUTPUT:
Hello
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment