
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP String Comparison: 0 vs String
The syntax ‘string0‘hasbeendeprecatedbeginningfromPHPversion6.Hence,itisstronglysuggestedtousestring[0].
In short, accessing characters using the flower braces {} has been deprecated. Hence the square brackets should be used [] −
Example
$string = 'medium'; echo $string{0}; echo $string[0];
Output
This will produce the following output −
mm
Advertisements