Re: file_exists() question

From: Date: Sat, 08 Mar 2003 23:36:00 +0000
Subject: Re: file_exists() question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-138792@lists.php.net to get a copy of this message
You will probably need to use file_exists("cherpdocs/{$annrow['id']}.doc") you could also use file_exists('cherpdocs/' . $annrow['id'] . '.doc') You should use single quotes to identify your element in an array, otherwise PHP will try to use it as a constant first. Jason On Sat, 2003-03-08 at 14:40, Khalid El-Kary wrote: > because you can't directly use the $annrow[id] within single quotes, you > should use double quotes to do so. > > file_exists("cherpdocs/$annrow[id].doc") > > or > > file_exists('cherpdocs/'.$annrow[id].'.doc') > > or > > file_exists("cherpdocs/".$annrow[id].".doc") > > Note: i heared it's prefered to always use the "." when including variables > within strings. > > Regards, > Khalid Al-Kary > http://creaturesx.ma.cx/kxparse/ > > > > > >Can anyone tell me why this code does not return true when the file in the > >directory cherpdocs/ with the file (which I see as being there) does exist? > > > >if(file_exists('cherpdocs/$annrow[id].doc')){ > > echo "<br /><a > > href=\"cherpdocs/$annrow[id].doc\">Funding details > >paper</a>"; > > } > > > >This is a path relative to the file calling it, should it be otherwise? > > > >Thanks > >Charles > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > _________________________________________________________________ > Add photos to your e-mail with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail -- Jason Sheets <jsheets@php.net>

« previous php.general (#138792) next »