Using trim() function but getting odd results
Posted: Thu Jun 30, 2005 1:33 pm
I have a filename that i want to use, so i can make a directory for those particular files. I setup my code as follows
When i run this script i get a directory of 15408, which is the numeric value of the string. Oddly when i tried taking the numbers out, i get a directory named 0. From what i have read and gathered im using this string correctly. Is there anything you can see wrong here??
As always your responses are greatly appreciated.
Regards
-soianyc
Code: Select all
<?php
$filename = '15408front.jpg';
$percent = .75;
$pathname = trim($filename, '.jpg');
$path = '/' + $pathname;
if(!file_exists($path)){
mkdir($path);
echo 'Directory '.$path.' Created';
}else{
echo 'Directory already exists <br />';
}
?>As always your responses are greatly appreciated.
Regards
-soianyc