Appendix A. Function List

This appendix lists all of the descriptions and declarations of the functions in this book. The declaration is described as follows:

returnType FunctionName(varType variable1, varType variable2,. . .)

All of the functions follow this pattern. If the function returns nothing, the return type is void. If the parameter is optional, brackets are placed around the parameter.

Table A.1. Functions
NameDescriptionCode
basename()Returns the filename component of a filename string.string basename(string $fullString)
copy()Copies the contents of one file to another.bool copy(string $source_filename, string $destination_filename)
define()Takes in a constant name and a constant value and defines the constant in the program.void define(string $constantName, int constantValue);
echoAlthough this is not a function (it is a language construct), it acts as one. Outputs the specified text or variable to the page.void echo (string $1, . . .)
exitAlthough this is not a function (it is a language construct), it acts as one. Causes the PHP page to immediately halt script execution. No following PHP commands are executed on the page.void exit (string/int $status);
fclose()Closes a file.void fclose(resource $handle);
filesize()Returns the size of a file in bytes.int filesize(string $filename);
fopen()Opens a file and returns a handle to it.resource fopen(string $filename, string $mode)
fread()Returns a string that contains all the contents inside the chosen file.string fread(resource $handle, int $sizeInBytes);
fwrite()Writes a string to an already opened file.bool fwrite(resource $handle, string $text);
gettype()Returns the type of the inputted variable.string gettype(anytype $variable);
header()Allows you to modify some sectionvoid header(string $newLocation); of the document header. Using the Location: attribute changes the web page’s URL.
isset()Confirms whether a variable has been created. Returns true if it already exists and false if not.bool isset(anytype $variable);
mail()Lets your web server send an email message.bool mail(string $to, string $subject, string $message, [string $additionalheaders], [string $additionalparameters])
move_uploaded_file()Moves a file from its temporary location to its final destination on your server.bool move_uploaded_file (string $source, string $destination);
nl2br()Takes in a string as a parameter and converts the new lines into <br /> tags. Allows proper display of strings in the web browser.string nl2br(string $text);
rename()Renames a file.bool rename(string $old_filename, string $new_filename);
session_name()Allows you to assign a name to your session. Includes a string parameter to change the name. If you leave the parameter blank, the current session’s name is returned.string session_name ([string $name]);
session_ start()Initiates or continues using a session. This function must be placed before any other echoed HTML or text.void session_start(void);
setcookie()Sets a cookie on the web server, which lets you store user data.bool setcookie(string, $name, [string $value, int $expire, string $path, string $domain, bool $secure])
stripslashes()Returns a string with all backslashes removed.string stripslashes(string $orginalString);
strval()Takes in a non-string as a parameter and returns the input as a string value.string strval(int $nonstring);
time()Returns the number of seconds since the epoch (returns the current time).int time(void);
unlink()Deletes a file.bool unlink(string $filename)
unset()Deletes an element of an array or an entire array, depending on what variable you pass.void unset(anytype $elementOrArray);

 

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.175.113