0

An issue with the exclamation mark

<?php $a = 'hello'; $hello = "Hi"; $Hi = "hola"; echo $$a; ?> // output is hola <?php $a = 'hello'; $hello = "Hi!"; $Hi! = "hola"; echo $$a; ?> //output is ERROR! what is wrong with the exclamation mark (!) ?

28th Dec 2016, 4:22 PM
Rami Magdi
Rami Magdi - avatar
4 Antworten
+ 2
It outputs an error because an exclamation mark is a special character and cannot be used in a variable name.
28th Dec 2016, 6:09 PM
King Moses
0
mmm can we add the word Hi! inside parentheses? >> $(Hi!)="hola"
28th Dec 2016, 6:18 PM
Rami Magdi
Rami Magdi - avatar
0
Including an exclamation mark in a variable name is not a legal declaration.
29th Dec 2016, 12:36 AM
Malvern Panashe Mhepo
Malvern Panashe Mhepo - avatar
- 2
?
28th Dec 2016, 6:25 PM
afgprogrammer
afgprogrammer - avatar