Witchcraft! Php [migrated]
- by Steve Green
This is madness, hoping someone can explain.
$dir = getcwd();
$a = "/bla/httpdocs/ble";
$b = "/bla/httpdocs/meh";
if( ($dir == $a) || ($dir == $b) ){
$dirlist = glob("../images2/spinner/*.jpg");
}else{
$dirlist = glob("images2/spinner/*.jpg");
}
works fine but
$dir = getcwd();
if( ($dir == "/bla/httpdocs/ble") || ($dir == "/bla/httpdocs/meh") ){
$dirlist = glob("../images2/spinner/*.jpg");
}else{
$dirlist = glob("images2/spinner/*.jpg");
}
doesn't. (By doesn't work I mean it returns false, I also tried === )
Wondered if strings were being null terminated so tried:
print_r(str_split($a)); //$a has been set to the string below for this.
print_r(str_split("/bla/httpdocs/ble"));
they returned identical arrays
Array ( [0] => / [1] => b [2] => l [3] => a [4] => / [5] => h [6] => t [7] => t [8] => p [9] => d [10] => o [11] => c [12] => s [13] => / [14] => b [15] => l [16] => e )
Array ( [0] => / [1] => b [2] => l [3] => a [4] => / [5] => h [6] => t [7] => t [8] => p [9] => d [10] => o [11] => c [12] => s [13] => / [14] => b [15] => l [16] => e )
Anyone?