- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
What happens if ++ operator is used with string value in PHP?
If you try to use ++ operator with string value then it increments the last character value with 1 and prints the ASCII value.
Following is the PHP code −
Example
<!DOCTYPE html> <html> <body> <?php $values = 'John'; echo "The string modified value is=",++$values,"<br>"; $values1="10.5"; echo "The string incremented value is=",++$values1; ?> </body> </html>
Output
The string modified value is=Joho The string incremented value is=11.5
Advertisements