date("m-d-y g:i:sa", filemtime($file));
?>
This returns the following:
File last updated: 06-09-03 1:26:14pm
Working with Files
Web applications are rarely 100 percent self-contained; that is, most rely on some
sort of external data source to do anything interesting. Two prime examples of such data
sources are files and databases. In this section you??™ll learn how to interact with files by
way of an introduction to PHP??™s numerous standard file-related functions. But first
it??™s worth introducing a few basic concepts pertinent to this topic.
The Concept of a Resource
The term resource is commonly used to refer to any entity from which an input or
output stream can be initiated. Standard input or output, files, and network sockets are
all examples of resources. Therefore you??™ll often see many of the functions introduced
in this section discussed in the context of resource handling, rather than file handling,
per se, because all are capable of working with resources such as the aforementioned.
However, because their use in conjunction with files is the most common application,
the discussion will primarily be limited to that purpose, although the terms
resource and file may be used interchangeably throughout.
CHAPTER 10 ?– WORKING WITH T HE FILE A ND OPERATING SYSTEM 287
Recognizing Newline Characters
The newline character, which is represented by the \n character sequence (\r\n on
Windows), represents the end of a line within a file.
Pages:
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360