Created
August 16, 2014 17:04
-
-
Save shahariaazam/0f92253149fbe0a55122 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 | |
| class MDC_IpManagerClass{ | |
| public $MyIp = $_SERVER['REMOTE_ADDR']; | |
| //................................................... | |
| // more code snippet | |
| //................................................... | |
| } | |
| /** | |
| * Here $MyIp is just a class property declaration. It can't holds any EXPRESSION. | |
| * | |
| * $_SERVER['REMOTE_ADDR'] is an expression. | |
| * | |
| * If you want to assign that expression to that property. You have to do that in that class constructor. | |
| * See the following snippet. | |
| */ | |
| class MDC_IpManagerClass{ | |
| public $MyIp; | |
| public function __construct() | |
| { | |
| $this->MyIp = $_SERVER['REMOTE_ADDR']; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment