I have a line in a file like this:
0000000/BirthstoneEnsemble/f/0/1380152724
I explode by $pieces = explode("/", $line);
when I do echo $pieces[0] == "0000000"
it returns false. I try to cast pieces[0]
to string, but it is always incorrect.
function build_file_assoc() {
global $dir;
$assoc = [];
$file_assoc = file($dir . 'rsnjxdlxwxwun.dbt');
for($i = 0; $i < count($file_assoc) - 1; $i++) {
if($i > 0) {
list($parent_folder, $image_name, $tag, $size, $date) = explode("/", $file_assoc[$i]);
$assoc[] = [
'parent_folder' => (string)$parent_folder,
'image_name' => $image_name,
'tag' => $tag,
'size' => $size,
'date' => $date
];
}
}
return $assoc;
}
$g = build_file_assoc();
$first = $g[0]['parent_folder'];
echo $first == "0000000"; // false
file contents:
0000000/BirthstoneEnsemble/f/0/1380152724
0000000/Thumbs.db/a/83968/1384248954
0000000/bridal images for frame/f/0/1380152879