Created
July 25, 2012 20:26
-
-
Save aramirez-es/3178450 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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