Operations on files and directories

duplication
To copy a file using a function called copy (). The first parameter is the source file and the second is the destination file or directory. This function returns true if the copy succeeded, or false otherwise. It is good to check whether the copying was successful.

(więcej…)

Information functions

When scripts for server maintenance or, for example, analyzing the file system, it is necessary to obtain information about a particular file. PHP offers a whole set of functions that return data on file with the specified path. I think it is best punch.

(więcej…)

Write to File

The data file can be saved with fputs (int pointer, string string, int length). As with most of the functions that operate on files, it is necessary to specify the file pointer to where we want to operate.

(więcej…)

Reading from files

Reading from a file can be carried out in 2 ways one is a „low-level” reading data from a file using fread (int index, int length). It reads the data read from the file specified by the previously created „indicator”. The data are read to the length specified in the second parameter. If the data is less than the specified length, it will be returned all the data from the file.

(więcej…)

The internal file pointer

The internal file pointer, means the place in the file indicating the current location ‚- ie the place in which would start the writing or reading. Most of the functions…

Opening and closing files

All functions use the file as a parameter called charge. „Pointer to the file.” It is a variable that specifies the file open. This is necessary because the script can open multiple files at once and at all work simultaneously.

(więcej…)

Replaces portions of strings

For substitution of entire passages used during the function str_replace (), which takes three parameters: the string to be swapped, a sequence which is to be swapped and a string of excerpts of which will be swapped.

(więcej…)

Pulling pieces of string

Very often there is a need to draw from the variable text only a portion thereof. The easiest way is if you know the length of the exhaust passage and a position in which it is located in a variable. Eg. If the variable contains „1999/10/20” We want to pull out the year.

(więcej…)

Comparing strings

The primary function used to compare strings is strcmp (). As the only 2 parameters it accepts text strings which are to be compared. This function returns 0 if the strings are the same, value greater than zero if the first string is greater than the second value or less than zero if the first string is less than the second. This function is case characters.

(więcej…)

Close Menu