Skip to content
Advertisement

Tag: object

PHP Fatal error: Using $this when not in object context

I’ve got a problem: I’m writing a new WebApp without a Framework. In my index.php I’m using: require_once(‘load.php’); And in load.php I’m using require_once(‘class.php’); to load my class.php. In my class.php I’ve got this error: Fatal error: Using $this when not in object context in class.php on line … (in this example it would be 11) An example how my

How to define an empty object in PHP

with a new array I do this: Is there a similar syntax for an object Answer A comment in the manual sums it up best: stdClass is the default PHP object. stdClass has no properties, methods or parent. It does not support magic methods, and implements no interfaces. When you cast a scalar or array as Object, you get an

Advertisement