- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which is faster? Constants, Variables or Variable Arrays in PHP?
Constants in PHP are defined using the 'define' function. They are fairly slow in PHP.
There are instances where extensions (such as hidef) were written to improve the performance of the code.
This comes into picture when there are thousands of constants.
Beginning from PHP version 5.3, compile-time constants with the help of const NAME = VALUE; can also be used. They are relatively quicker.
- Related Articles
- PHP variable Variables
- Which is faster, a MySQL CASE statement or a PHP if statement?
- Which is faster, NumPy or pandas?
- What is faster: many ifs, or else if in PHP?
- Which one is faster Array or List in Java
- PHP Constants
- What is the difference between constants and variables?
- PHP Class Constants
- In which medium sound travels faster: air or iron?
- PHP Predefined Mathematical Constants
- Difference between constants and final variables in Java?
- How to create Variables and Constants in C++?
- Which is better PHP SOAP or NuSOAP?
- Which is better: PHP or Python? Why?
- Which is faster between C++ and C#?

Advertisements