75
Presentation Zeeshan Ahmed Group No 3 Rashid Nawaz Saad Sattar Abdul Wahab

PHP FUNCTIONS

Embed Size (px)

DESCRIPTION

PHP FUNCTIONS AND DATABASE

Citation preview

Presentation

Presentation

Zeeshan Ahmed

Group No 3

Rashid Nawaz

Saad Sattar

Abdul Wahab

Functions in PHP

PHP Form

Post And Get Method

Usage of PHPMYADMIN

Making Database

MYSQL

PHP data base connectivity

Topics

Defination:

Functions are the group of statements that you can execute as a single unit. Function definations are the lines of code that make up a function

The syntax for defining a function is:

There are two types of functions.

Built-in functions.

User defined functions.

Functions in PHP

PHP has lots of built-in functions that we use all the time.

Some of the function are given below:

PHP Array Functions

PHP Calendar Functions

PHP File System Functions

PHP MySQL Functions

Math functions

Built-in Functions

PHP Array Functions:

These functions allow you to interact with and manipulate arrays in various ways. Arrays are essential for storing, managing, and operating on sets of variables. Some Array Functions are:

Array(), Array push(), Array pop() etc.

Example of Array():

Example Of Array push():

Example Of Array pop():

PHP Calendar Functions:

The calendar extension presents a series of functions to simplify converting between different calendar formats. Some PHP Calendar Functions are:

Cal info(), Cal days in month() etc.

Example of Cal info()

7

Example of Cal days in month().

PHP Filesystem Functions:

The filesystem functions are used to access and manipulate the filesystem PHP provides you all the posible functions you may need to manipulate a file.

List:

Copy(), delete(), file(), filetype() etc

MySQL Functions:

These are functions dealing with MySQL handling and logging or to control the MySQL through PHP functions.

List:

mysql_close(), mysql_connect() etc.

Example:

Math functions:The math functions can handle values within the range of integer and float types.

List:

hexdec(), sqrt(), sin() etc

Example of hexdec():

11

Example of sqrt():

Example of sin():

A user defined functionis a user-defined set of commands that are carried out when the function is called.

Syntax:

Function functionName()

{

code to be executed;

}

NOTE:

A function should start with keywordfunctionand all the function code should be put inside { and } brace.

A function name can start with a letter or underscore not a number.

The function names are case-insensitive.

User Defined Functions

13

Information can be passed to functions through arguments. An argument is just like a variable.

Arguments are specified after the function name, inside the parentheses.

You can add as many arguments as you want, just separate them with a comma.

PHP Function Arguments

User Defined Function Without Arguments

Examples

User Defined Function With One Argument

Examples

User Defined Function With One Argument