Search Results: Found 2
PHP TypeError Deep Dive: How to Fix 'Argument must be of type ?array, string given'
2025-12-19 DP

In modern PHP development, type hinting significantly improves code robustness, but it also introduces common errors like `TypeError: Argument must be of type ?array, string given`. This error occurs when a function expects a nullable array but receives an empty string, often from request data or other sources. This article provides a deep dive into the root cause of this error and offers three practical and elegant solutions to help you write more resilient and fault-tolerant code.

PHP Case Conversion Mastery: `strtolower()` vs. `mb_strtolower()` - Are You Using the Right One?
2025-11-28 DP

Converting uppercase strings to lowercase is a fundamental task in PHP development. This guide provides a deep dive into PHP's three core case conversion functions: `strtolower()`, `mb_strtolower()`, and `lcfirst()`. Through code examples and scenario analysis from author DP, we'll help you understand their differences, performance implications, and best practices, ensuring you make the right choice when handling user input or internationalized projects.