PHP 5.6 Tutorial

Accessing Data in Query Strings in PHP

Accessing Data in Query Strings in PHP To access the field names and values in a query string you simply use the $_GET superglobal array function. Syntax $firstName = $_GET[“firstName”]; Example Here, we will illustrate an example which displays a sequence of Square numbers. Save the script as number_squaring.php in the document root folder, and run it …

Accessing Data in Query Strings in PHP Read More »

Creating a PHP Session

PHP Session new session, this function generates a unique SID for the session and sends it to the browser as a cookie called PHPSESSID (by default). However, if the browser has sent a PHPSESSID cookie to the server because a session already exists, session_start() uses this existing session: session_start();

What Is a Regular Expression in PHP ?

Regular expression provides a special syntax for searching for patterns of text within strings. A regular expression is simply a string of search text. Regular expressions are included by delimiters (usually slashes). For example, this simple regular expression searches for the word “ csitquestion ” anywhere within the target string: /csitquestion/ Regular expressions start to become …

What Is a Regular Expression in PHP ? Read More »

Pattern Matching in PHP

PHP’s main pattern  matching function is preg_match() . This function takes the following arguments: The regular expression to search for (as a string) The string to search through An optional array to store any matched text in. An optional integer specifying any flags for the match operation. Currently only one flag is supported: PREG_OFFSET_CAPTURE . …

Pattern Matching in PHP Read More »