Fast Uncompromising Discussions. FUDforum will get your users talking.
Logout [ CommonCrawl [Bot] ]
Logged in user:
CommonCrawl [Bot] [
list all smilies
Editing Time Limit
Allowed File Extensions:
jpg jpeg png gif txt doc gz bz2 inc php zip diff
Maximum File Size:
Maximum Files Per Message:
Notify me when someone replies to this message.
Include your profile signature.
Disable smilies in this message
PHP object scope
Thu, 18 April 2013 02:55
Can somebody explain to me the concept of object scope in PHP? I'm very new to objects in PHP and the reason I ask is because I was able to create an object within an if statement, and then access the object outside the scope of the if statement.
//only create object if some condition is met
$myBook = new Book('PHP for Dummies','softcopy');
I would have though that this would generate an error but it didn't.
Some background to my question
I was trying to figure out how to determine which constructor to call depending on the condition that is met. The only conceivable way was to introduce an if statement but doing that, I thought would impose the issue of scope which it didn't and I'm just wondering why..
Sun Feb 16 21:26:49 EST 2020
Total time taken to generate the page: 0.01105 seconds
Powered by: FUDforum 3.0.8.
FUDforum Bulletin Board Software