---
title: "The Forbidden PHP Features Encyclopedia"
url: https://www.exakat.io/the-forbidden-php-features-encyclopedia/
date: 2024-01-06
modified: 2026-05-27
author: "dams"
description: "The Forbidden PHP Features Encyclopedia Within the vast realm of PHP development, certain features have incurred the disapproval of various developers, leading to their outright exclusion from conscientious coding practices...."
categories:
  - "Code auditing"
tags:
  - "anti-pattern"
  - "forbidden"
  - "php"
image: https://www.exakat.io/wp-content/uploads/2022/01/speedbump.300.jpg
word_count: 529
---

# The Forbidden PHP Features Encyclopedia

# The Forbidden PHP Features Encyclopedia

Within the vast realm of PHP development, certain features have incurred the disapproval of various developers, leading to their outright exclusion from conscientious coding practices. This comprehensive encyclopedia serves as a curated catalog, shedding light on the forbidden features that have faced scrutiny and are best avoided in the pursuit of secure, maintainable, and efficient PHP code. Explore this authoritative guide to safeguard your projects and adopt best practices in the ever-evolving landscape of PHP development.

Here are things that you should not use in your code. The reasons are behind the links.

- **array_merge()**

[Never Use array_merge() in a loop](https://dev.to/chemaclass/never-use-arraymerge-in-a-loop-3mj0)

- ** compact()**

[You'll Never Believe What One Developer Did With compact()](https://radcampaign.com/blog/youll-never-believe-what-one-developer-did-compact)
- [PHP's "compact" - Pros and cons](https://laracasts.com/discuss/channels/general-discussion/phps-compact-pros-and-cons)
-
[`compact()` function in PHP, and why it is problematic due to its magic behavior](https://gist.github.com/Ocramius/c56a8e8ff25a8e0bd96800c41edab02a)
-
[PHP 8.1: Warning on `compact` function calls with non-string and non-array string parameters](https://php.watch/versions/8.1/compact-non-string-warning)

- **boolean as arguments**

[The danger of boolean flags in object methods](https://sarah-savage.com/the-danger-of-boolean-flags-in-object-methods/)

- **closing tags**

[Should You Close PHP Tags? The Debate Continues...](https://www.sitepoint.com/closing-php-tags-debate/)

- **else**

[Avoid using else ](https://freek.dev/2212-avoid-using-else)
- [How to simply avoid “else” in PHP and other programming languages](https://thomas-sanctorum.medium.com/how-to-simply-avoid-else-in-php-and-others-programming-language-ccd6a07c4e1)

- **empty()**

[When to use empty in PHP? I'd say never](https://www.beberlei.de/post/when_to_use_empty_in_php_i_say_never)
- [Using isset() and empty() hurts your code ](https://dev.to/aleksikauppila/using-isset-and-empty-hurts-your-code-aaa)
- [Avoiding empty() in PHP](https://localheinz.com/articles/2023/05/10/avoiding-empty-in-php/)
- [Be Careful Using PHP's empty()](https://www.zachstronaut.com/posts/2009/02/09/careful-with-php-empty.html)
- [Never use the empty function](https://dev.to/klnjmm/never-use-empty-function-in-php-4pb0)

- **eval()**

[When is eval evil in php?](https://stackoverflow.com/questions/951373/when-is-eval-evil-in-php)
- [Eval Is Evil: Analyzing Performance of Web Applications Based on PHP and JavaScript by Static Analysis](https://link.springer.com/chapter/10.1007/978-981-10-3935-5_12)
- [The Delicious Evils of PHP](https://www.sitepoint.com/the-delicious-evils-of-php/)
- [The Danger Of PHP Eval()](https://medium.com/%40pkhuyar/the-danger-of-php-eval-a23410187ca2)
- [The land where PHP uses Eval()](https://www.exakat.io/land-where-php-uses-eval/)
- [What you should know about PHP security](https://snyk.io/fr/blog/php-code-security/)
- [Massive abuse of abandonned Eval PHP wordpress plugin](https://blog.sucuri.net/2023/04/massive-abuse-of-abandoned-evalphp-wordpress-plugin.html)
- [7 schocking dangers of PHP eval()](https://hyscaler.com/insights/7-shocking-dangers-of-php-eval-function/)
- [PHP code injections and 4 prevention tips](https://brightsec.com/blog/code-injection-php/)
- [Why you should always avoid PHP eval() function](https://qubitsandbytes.co.uk/php/why-you-should-avoid-phps-eval-function/)

- **extends**

[Inheritance vs Composition: Composition wins by knockout](https://r.je/you-do-not-need-inheritance-oop)
- [Stop Using “extends” in PHP](https://blog.devgenius.io/stop-using-extends-in-php-37c9da1cce83)
- [Are Traits and Inheritance antipatterns in PHP?](https://zero1-dev.medium.com/are-traits-and-inheritance-antipatterns-in-php-64c67f97011a)

- **extract()**

[PHP bad practice: the use of extract()](https://dzone.com/articles/php-bad-practice-use-extract)

- **float**

[No Floaters](https://github.com/Roave/no-floaters)

- **global**

[Are global variables considered bad practice in PHP?](https://www.quora.com/Are-global-variables-considered-bad-practice-in-PHP)

- **goto**

[GOTO in PHP 5.3: is it Really That Evil?](https://www.phparch.com/2009/06/goto-in-php-5-3-is-it-really-that-evil/)

- **Interfaces**

[Object interfaces are evil](https://tonymarston.net/php-mysql/object-interfaces-are-evil.html)
- [Interface objects may only include hooked properties](https://peterbabic.dev/blog/interfaces-may-only-include-hooked-properties/)
- [Please Do Not Interface the PHP World](https://hermanradtke.com/2011/10/22/please-do-not-interface-the-php-world.html/)
- [Interfaces in PHP don't make complete sense](https://medium.com/@maxalmonte14/interfaces-in-php-dont-make-complete-sense-4e63be8e4233)

- **Named parameters**

[Opting-out of named parameters](https://php.watch/articles/no-named-arguments-docblock-attribute)

- **Promoted properties**

[Why I dislike the PHP 8 Constructor Property Promotion in the current state](https://pegasusgate.net/+bob/35/why-i-dislike-the-php-8-constructor-property-promotion-in-the-current-state)

- **Runtime checks**

[We don't need runtime type checks](https://stitcher.io/blog/we-dont-need-runtime-type-checks)

- **strict_types**

[Why use declare(strict_types=1) in PHP – Fast tips](https://inspector.dev/why-use-declarestrict_types1-in-php-fast-tips/)

- **Singleton pattern**

[Don't use a Singleton pattern](https://github.com/piotrplenik/clean-code-php#dont-use-a-singleton-pattern)
- [Stop Using “Singleton” Pattern](https://medium.com/@dotcom.software/stop-using-singleton-pattern-c078abc99eb2)
- [The truth about the truth about static and singletons](https://dev.to/jmau111/the-truth-about-the-thruth-about-static-and-singletons-lfe)

- **Static methods**

[Don't Use Service Classes with Static Methods ](https://dev.to/clintwinter/dont-use-service-classes-with-static-methods-1ebo)
- [When Should You (And Shouldn’t You) Use Static Methods in Laravel/PHP? A Practical Guide.](https://medium.com/@laravelprotips/when-should-you-and-shouldnt-you-use-static-methods-in-laravel-php-a-practical-guide-1b1caac46f2d)

- **String with variables**

[Prefer string interpolation over concatentation in PHP](https://roman-huliak.medium.com/prefer-string-interpolation-over-concatenation-in-php-b6c3c651deda)
- [String interpolation in PHP](https://jeffreyeverhart.com/2019/11/21/string-interpolation-in-php/)
- [Learning PHP: Concatenate Strings and Variables Efficiently](https://wpshout.com/php-concatenate-strings/)

-  **Traits**

[My Love / Hate Relationship with PHP Traits](https://www.coderslexicon.com/my-love-hate-relationship-with-php-traits/)
- [Are Traits and Inheritance antipatterns in PHP?](https://zero1-dev.medium.com/are-traits-and-inheritance-antipatterns-in-php-64c67f97011a)
- [Why I Avoid PHP Traits (And What I Use Instead)](https://dev.to/tegos/why-i-avoid-php-traits-and-what-i-use-instead-1288?ref=dailydev)

- **array type**

[never type hint on arrays](https://steemit.com/php/@crell/php-never-type-hint-on-arrays)

- **Type checks**

[We don't need execution type checks](https://stitcher.io/blog/we-dont-need-runtime-type-checks)

- **One letter variables**

[Is there a time and place for single letter variable](https://chuniversiteit.nl/papers/single-letter-variables)

- **Variable variables**

[The Dangers of PHP's $$](https://andycarter.dev/blog/the-dangers-of-php-variable-variables)