Tagged articles
2 articles
Page 1 of 1
php Courses
php Courses
Jan 2, 2024 · Backend Development

PHP Function Overloading Analysis and Practical Pseudo‑Overloading Techniques

The article explains why PHP cannot support true function overloading due to its weak typing, then demonstrates three practical techniques—default parameters, using func_get_args with call_user_func_array, and the __call magic method—to achieve pseudo‑overloading with illustrative code examples.

Magic MethodPHPfunction overloading
0 likes · 4 min read
PHP Function Overloading Analysis and Practical Pseudo‑Overloading Techniques
php Courses
php Courses
Jul 7, 2023 · Backend Development

Understanding the __invoke() Magic Method in PHP

This article explains PHP's __invoke() magic method, showing how defining __invoke() allows an object to be called like a function, demonstrates usage with a Person class example, and notes version requirements and error behavior when misused.

Backend DevelopmentMagic MethodObject Invocation
0 likes · 2 min read
Understanding the __invoke() Magic Method in PHP