Ben bir değişken denir kök var. Bu değişkenin değeri 0
$root = 0;
if($root == "readmore"){
$root = 1701;
}
$ kök 0 ise bir şekilde bazı garip nedenle hala yukarıda eğer deyimi enteres? Ben ne olabilir hiçbir fikrim yok
temelde, bu karşılaştırma yapıyor:
if (0 == 'readmore') {
// ...
}
Hangi 'Readmore' anlamına gelen bir tamsayı dönüştürülür; ve 'readmore', bir tam sayıya dönüştürülür, 0'dır.
Bu konuda, Type Juggling kılavuzda görmek ve aynı zamanda String conversion to numbers, hangi devletler (quoting):
If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero).
You might want to use the === operator, which will prevent that kind of conversion :
if($root === "readmore") {
// You will not enter here, if $root is 0
}
Bkz Comparison Operators.