It’s a reference to the current object, it’s most commonly used in object oriented code.
- Reference: http://www.php.net/manual/en/language.oop5.basic.php
- Primer: http://www.phpro.org/tutorials/Object-Oriented-Programming-with-PHP.html
Example:
<?php class Person { public $name; function __construct( $name ) { $this->name = $name; } }; $jack = new Person('Jack'); echo $jack->name;
This stores the ‘Jack’ string as a property of the object created.
Related Posts:
- Understanding Python super() with __init__() methods [duplicate]
- What is the difference between private and protected members of C++ classes?
- When should I use ‘self’ over ‘$this’?
- How do you implement a class in C?
- What is the purpose of the word ‘self’?
- Is it possible to make abstract classes in Python?
- When should you use a class vs a struct in C++?
- Using two CSS classes on one element
- How to assign multiple classes to an HTML container?
- C++ [Error] no matching function for call to
- What does ‘super().__init__()’ mean in python 3.x?
- How to assign multiple classes to an HTML container?
- Are static class variables possible in Python?
- Python: How do I make a subclass from a superclass?
- PHP Fatal error: Using $this when not in object context
- Separating class code into a header and cpp file
- Difference between ‘cls’ and ‘self’ in Python classes?
- Error “C++ requires a type specifier for all declarations whilst defining methods”
- What are the differences between struct and class in C++?
- How to implement a binary search tree in Python?
- Python function overloading
- How do I define string constants in C++?
- C++ variable has initializer but incomplete type?
- C++ – No appropriate default constructor available
- Why do some classes require main methods and others do not?
- What is the syntax for accessing PHP object properties?
- Pass arguments to Constructor in VBA
- What is predicate in C++?
- uml classdiagram constructor with parameters
- Does C have classes?
- Error: invalid use of member in static member function
- How can I design a class named allergy?
- Using OOP in themes
- Should all plugins be encapsulated in a Class?
- add_action in namespace not working
- What is the correct way to build a widget using OOP
- Does an activated plugin automatically mean its methods are available to other WP functions?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Best way to extends core classes in theme?
- OOP Plugin Development. Including external object
- Check if a class exists within a method
- WP Plugin + OOP: Adding Menu Page doesn’t create required effect
- Initiate only latest version of a class
- How to do conditional publishing?
- Extend a class of a plugin
- Shortcode Inside Class Not Working
- How to get media objects
- Applying OO patterns and principles to plugin development
- Use object in template part
- database interactions using OOP
- Customizer – Prefix Class Extension
- Extending the WP_Widget_Text class
- Trying to get property of non-object “ wordpress ”
- How to prevent XSS alter custom global javascript object & methods in WordPress
- Most efficient way to use classes to create admin pages using Settings API
- Basic Object Oriented plugin question
- Using plugin functions/methods within templates
- Why is my custom post type not being activated on plug-in activation?
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Undefined method class::construct() when creating a plugin
- How can I access string value in an array?
- Need oop for wordpress theme? [duplicate]
- Usage of call back function of add_meta_box()
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Cant register rest routs from class instance
- Built a second plugin but it overwrote the first one
- Check class_exists before class definition / Doxygen problem
- PHP Helper Class to create shortcodes
- Accessing a protected property of a post
- Class property seems to lose scope, attached to save_post action?
- Get options from database using php class
- OOP PHP class extends TwentyTwenty_Customize in Child Theme
- add_action in namespace not working
- Call to “admin_notices” hook from a static method
- WordPress Custom Hook with Class method
- Plugin Development using classes – Public & Private Callbacks
- Use PHP Class in WordPress functions
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- WordPress plugin blog creation
- Access variable from another class that was passed in constructor
- How to add typehints to function in functions.php when argument is an object?
- Proper use of Output Buffer for a whole php clas
- Get post content inside plugin class method
- Calling WordPress hook from within a class: call to undefined function error
- PHP calling function within a class
- Meta Box not being added in plugin
- What is wrong with assigning values to a WP_List_Table class?
- calling a function from a class in your template
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Property value of null when value is assigned inside a method hooked to the wp action hook
- private functions in plugins
- Retrieve IDs from custom field, count and display results differently according to count
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Issues separating my Plugin pages into different files
- Strict Standards: Non-static method in sidebar generator
- $_html is empty when var dumped
- Function not being called on form submit, only blank admin-post.php page
- How to reference nested classes with css?
- From where come that JS files in ?
- WP CRON duplicate wp_insert_post with has < and > tag