Andrew Fletcher published: 3 August 2022 1 minute read
Explain public, private, protected functions and variables inside a class in PHP.
I'll define a variable as a property
public | method or property this is the default and can be accessed anywhere |
protected | method or property that can be accessed by the class that declared it or that inherits the class |
private | method or property that can only be accessed by the class that declared it |
Related articles
Andrew Fletcher
•
10 Sep 2024
Resolving PHP GD library issues in Drupal
IntroductionFor a while now, one persistent issue has been bugging me: a warning on Drupal's 'status report' page that reads:GD librarylibrary bundled (2.1.0 compatible)Supported image file formats: GIF, PNG.Unsupported image file formats: JPEG, WEBP.Check the PHP GD installation documentation if...
Andrew Fletcher
•
03 Sep 2024
Best practices and methods on how to create a Drupal 10 patch
When working on Drupal projects, especially in a collaborative environment, it’s crucial to follow best practices for creating and managing patches. Patches are essential for contributing back to the community, applying quick fixes, or sharing custom changes with your team. In this article, we'll...
Andrew Fletcher
•
31 May 2024
Connecting AWS S3 with Docker for Drupal 10
Recently, I encountered an issue where my local Docker environment refused to connect to AWS S3, although everything worked seamlessly in AWS-managed environments. This challenge was not just a technical hurdle; it was a crucial bottleneck that needed resolution to ensure smooth Drupal deployments...