0

Can anyone explain me the proper use of '' and "" in php with difference??

<?php $a="hello"; $hello="hi"; echo $a; ?> why they used "hello" and 'hi'?? plz explain??

9th Oct 2017, 4:17 PM
Mansi Chaudhary
Mansi Chaudhary - avatar
1 Resposta
0
$i = 0; echo '$i'; //output: $i echo "$i"; //output: 0 as you can see, variables in single quotes are not changed with their value. Variables with double quotes, however, get replaced with their value when echoed. But when you declare an variable, it doesn't matter, because PHP has weak dynamic type declaration, so anyways the given value will have a 'string' type.
9th Oct 2017, 5:16 PM
Freezemage
Freezemage - avatar