PHPMy SQL Tutorial Nguyn Quang Hng Email hungnq

  • Slides: 43
Download presentation
PHP/My. SQL Tutorial Nguyễn Quang Hùng E-mail: hungnq 2@dit. hcmut. edu. vn Web site:

PHP/My. SQL Tutorial Nguyễn Quang Hùng E-mail: hungnq 2@dit. hcmut. edu. vn Web site: http: //www. dit. hcmut. edu. vn/~hungnq/courses. htm

Mục tiêu n n n Nắm bắt công nghệ lập trình trang web động

Mục tiêu n n n Nắm bắt công nghệ lập trình trang web động bằng PHP. Tìm hiểu về cách truy vấn CSDL My. SQL từ PHP. Viết một ứng dụng Tra cứu danh bạ điện thoại bằng JSP. Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Lập trình web phía server n Lập trình Web với CGI (tự học) n

Lập trình web phía server n Lập trình Web với CGI (tự học) n Lập trình Web với ASP/ASP. NET (tự học) n Lập trình Web với Servlet (tự học) n Lập trình Web với JSP (chương 7) n Lập trình Web với PHP (hôm nay) Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Introduction n PHP (Hypertext Preprocessor) - Open source, server-side, scripting language. - Supports databases

Introduction n PHP (Hypertext Preprocessor) - Open source, server-side, scripting language. - Supports databases such as My. SQL and Oracle. - http: //www. w 3 schools. com/php/default. asp n My. SQL (Structured Query Language) - Open source, speedy, scalable, reliable database technology. - http: //dev. mysql. com/doc/mysql/en/Tutorial. html Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Tutorial Overview n n Database (My. SQL) n DB creation n Add/delete tables n

Tutorial Overview n n Database (My. SQL) n DB creation n Add/delete tables n Add/delete/update records n View/query records Web (PHP) n User front-end n Add & query code n Delete & update code Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

My. SQL & TCD (1) ‘Pu. TTY’ into wilde. cs. tcd. ie on port

My. SQL & TCD (1) ‘Pu. TTY’ into wilde. cs. tcd. ie on port 22 w/ SSH - Authenticate with your TCD username and password (2) ssh macneil. cs. tcd. ie (password as above) (3) Login into your My. SQL account ‘mysql –u. USERNAME –p’ Enter your My. SQL username and password (4) Use My. SQL syntax to create and view table(s), records, etc. Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Basic My. SQL Syntax n SHOW DATABASES; n USE database_name; n SHOW TABLES; n

Basic My. SQL Syntax n SHOW DATABASES; n USE database_name; n SHOW TABLES; n DROP TABLE table_name; Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Create My. SQL Table CREATE TABLE user ( name varchar(9) NOT NULL, id int(6)

Create My. SQL Table CREATE TABLE user ( name varchar(9) NOT NULL, id int(6) NOT NULL, PRIMARY KEY (id), UNIQUE (id) ); Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Add/Delete/Update Table n INSERT INTO user VALUES (‘bond’, ‘ 007’); n DELETE FROM user

Add/Delete/Update Table n INSERT INTO user VALUES (‘bond’, ‘ 007’); n DELETE FROM user WHERE id=‘ 007’; n UPDATE user SET name=‘BOND’ WHERE id=‘ 007’; Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Query Database n SELECT * FROM user; n SELECT * FROM user WHERE name=‘BOND’;

Query Database n SELECT * FROM user; n SELECT * FROM user WHERE name=‘BOND’; n SELECT DISTINCT name FROM user; n SELECT name, id FROM user ORDER BY name; Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

My. SQL Administrator GUI tool Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu.

My. SQL Administrator GUI tool Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP User Front-End <html> <body> <? php $variable=“ 271004"; echo $variable; ? > </body>

PHP User Front-End <html> <body> <? php $variable=“ 271004"; echo $variable; ? > </body> </html> n n Script is executed server side and presented to user via a browser. PHP code is rendered as plain HTML. Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP Configuration File <? • Use a securely positioned ‘config’ file to store variables.

PHP Configuration File <? • Use a securely positioned ‘config’ file to store variables. // configuration parameters // database configuration $host = "macneill. cs. tcd. ie"; $user = “username"; • Other PHP pages can link to it and use the variables as their own. $pass = “password"; $db = “username_db"; // default contact person $def_contact = “Karl"; ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP Add to DB Code 1 <table cellspacing="5" cellpadding="5"> <form action="add. Update. php" method="POST">

PHP Add to DB Code 1 <table cellspacing="5" cellpadding="5"> <form action="add. Update. php" method="POST"> <tr> <td valign="top"><b><font size="1">Title</font></b></td> <td><textarea name="title" cols="40" rows="2"></textarea></td> </tr> <td valign="top"><b><font size="1">Authors</font></b></td> <td><textarea name="authors" cols="40" rows="2"></textarea></td> </tr> … <inut type="Submit" name="submit" value="Add"></td></tr> </form> </table> Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP Add to DB Code 2 <? include("conf. php"); // form submitted so start

PHP Add to DB Code 2 <? include("conf. php"); // form submitted so start processing it $title = $_POST["title"]; $authors = $_POST["authors"]; // set up error list array & validate text input fields $error. List = array(); $count = 0; if (!$title) { $error. List[$count] = "Invalid entry: Title"; $count++; } // set default value for contact person if (!$contact) { $contact = $def_contact; } // check for errors & if none found. . . if (sizeof($error. List) == 0) $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); mysql_select_db( $db ) or die ("Unable to select database!"); $query = "INSERT INTO papers (title, authors, description, comment, super, bibtex, url, genre) VALUES ('$title', '$authors', '$description', '$comment', '$super', '$bibtex', '$url', '$genre')"; $result = mysql_query( $query ) or die ("Error in query: $query. ". mysql_error()); echo "<font size=-1>Addition successful. <a href=papers. php>Go back to the main page</a> | <a href=http: //www. cs. tcd. ie/Karl. Quinn/>home</font>"; n // close database connection mysql_close($connection); } Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn else {// errors occurred}

PHP Query Code include("conf. php"); $connection = mysql_connect($host, $user, $pass) or die (); mysql_select_db($db)

PHP Query Code include("conf. php"); $connection = mysql_connect($host, $user, $pass) or die (); mysql_select_db($db) or die ("Unable to select database!"); $query = "SELECT * FROM papers"; $result = mysql_query($query) or die ("Error in query”); ? > <table cellpadding="0" cellspacing="0" border="0" width="622"> <tr><td bgcolor="990000"><img src="images/spacer. gif" alt="" height="2"></td></tr> <? // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset & print title with links to edit and delete scripts while($row = mysql_fetch_object($result)) ? > <font size="-2"><a href="edit. php? id=<? echo $row->id; ? >">edit/view</a> | <a href="delete. php? id=<? echo $row->id; ? >">delete</a></font><p> <font size="-1"><b><? echo $row->title; ? ></b> <font size="-1"><b>-<? echo $row->authors; ? ></b> <a href="<? echo $row->url; ? >" target="_blank"> pdf</a> </font> <table cellpadding="0" cellspacing="0" border="0" width="622"> <tr><td bgcolor="990000"><img src="images/spacer. gif" alt="“ height="2"></td></tr> <? } } // if no records present else{} mysql_close($connection); ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP Delete Code include("conf. php"); // form not yet submitted, display initial form with

PHP Delete Code include("conf. php"); // form not yet submitted, display initial form with values pre-filled $id=$_GET['id']; { // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "DELETE FROM papers WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. ". mysql_error()); // close database connection mysql_close($connection); // print result echo "<font size=-1>Deletion successful. <a href=papers. php>Go back to the main page</a> | <a href=http: //www. cs. tcd. ie/Karl. Quinn/>home</font>"; } Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

PHP Update Code 1 $id=$_GET['id']; if (!$submit) { $connection = mysql_connect($host, $user, $pass) or

PHP Update Code 1 $id=$_GET['id']; if (!$submit) { $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); mysql_select_db($db) or die ("Unable to select database!"); $query = "SELECT title, authors, description, comment, super, bibtex, url, genre FROM papers WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. ". mysql_error()) if (mysql_num_rows($result) > 0) { $row = mysql_fetch_object($result); // print form with values pre-filled ? > <table cellspacing="5" cellpadding="5"> <form action="Update. php" method="POST"> <input type="hidden" name="id" value="<? echo $id; ? >"> <tr> <td valign="top"><b><font size="-1">Title</font></b></td> <td><textarea name="title" cols="40" rows="2"><? echo $row->title; ? ></textarea></td> </tr> <td valign="top"><b><font size="-1">Authors</font></b></td> Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn <td><textarea name="authors" cols="40" rows="2"><? echo $row >authors; ? ></textarea></td>

PHP Update Code 2 include("conf. php"); // form submitted so start processing it $title

PHP Update Code 2 include("conf. php"); // form submitted so start processing it $title = $_POST["title"]; $authors = $_POST["authors"]; $id = $_POST["id"]; // set up error list array $error. List = array(); $count = 0; // validate text input fields if (!$title) { $error. List[$count] = "Invalid entry: Title"; $count++; } if (!$contact) { $contact = $def_contact; } // check for errors, if none found. . . if (sizeof($error. List) == 0) { $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); mysql_select_db($db) or die ("Unable to select database!"); $query = "UPDATE papers SET title = '$title', authors = '$authors', description = '$description', comment = '$comment', super = '$super', bibtex = '$bibtex', url = '$url', genre = '$genre' WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. ". mysql_error()); // print result echo "<font size=-1>Update successful. <a href=papers. php>Go back to the main page</a> | <a href=http: //www. cs. tcd. ie/Karl. Quinn/>home</a></font>"; // close database connection mysql_close($connection); } else{} ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Tài liệu tham khảo 1. http: //www. w 3 schools. com/php_forms. asp 2. http:

Tài liệu tham khảo 1. http: //www. w 3 schools. com/php_forms. asp 2. http: //www. w 3 schools. com/php_mysql_intro. asp 3. http: //www. php. net/mysql 4. http: //www. w 3 schools. com/php_mysql_intro. asp Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Brief History of PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994.

Brief History of PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994. It was initially developed for HTTP usage logging and server-side form generation in Unix. PHP 2 (1995) transformed the language into a Server-side embedded scripting language. Added database support, file uploads, variables, arrays, recursive functions, conditionals, iteration, regular expressions, etc. PHP 3 (1998) added support for ODBC data sources, multiple platform support, email protocols (SNMP, IMAP), and new parser written by Zeev Suraski and Andi Gutmans. PHP 4 (2000) became an independent component of the web server for added efficiency. The parser was renamed the Zend Engine. Many security features were added. PHP 5 (2004) adds Zend Engine II with object oriented programming, robust XML support using the libxml 2 library, SOAP extension for interoperability with Web Services, SQLite has been bundled with PHP Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Brief History of PHP As of August 2004, PHP is used on 16, 946,

Brief History of PHP As of August 2004, PHP is used on 16, 946, 328 Domains, 1, 348, 793 IP Addresses http: //www. php. net/usage. php This is roughly 32% of all domains on the web. Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Why is PHP used? 1. Easy to Use Code is embedded into HTML. The

Why is PHP used? 1. Easy to Use Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". <html> <head> <title>Example</title> </head> <body> <? php echo "Hi, I'm a PHP script!"; ? > </body> </html> Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Why is PHP used? 2. Cross Platform Runs on almost any Web server on

Why is PHP used? 2. Cross Platform Runs on almost any Web server on several operating systems. One of the strongest features is the wide range of supported databases Web Servers: Apache, Microsoft IIS, Caudium, Netscape Enterprise Server Operating Systems: UNIX (HP-UX, Open. BSD, Solaris, Linux), Mac OSX, Windows NT/98/2000/XP/2003 Supported Databases: Adabas D, d. Base, Empress, File. Pro (readonly), Hyperwave, IBM DB 2, Informix, Ingres, Inter. Base, Front. Base, m. SQL, Direct MS-SQL, My. SQL, ODBC, Oracle (OCI 7 and OCI 8), Ovrimos, Postgre. SQL, SQLite, Solid, Sybase, Velocis, Unix dbm Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Why is PHP used? 3. Cost Benefits PHP is free. Open source code means

Why is PHP used? 3. Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free. PHP Software Free Platform Free (Linux) Development Tools Free PHP Coder, j. Edit Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Getting Started 1. n How to escape from HTML and enter PHP mode PHP

Getting Started 1. n How to escape from HTML and enter PHP mode PHP parses a file by looking for one of the special tags that tells it to start interpreting the text as PHP code. The parser then executes all of the code it finds until it runs into a PHP closing tag. HTML PHP CODE HTML <? php echo “Hello World”; ? > Starting tag Ending tag Notes <? php ? > Preferred method as it allows the use of PHP with XHTML <? ? > Not recommended. Easier to type, but has to be enabled and may conflict with XML <script language="php"> ? > Always available, best if used when Front. Page is the HTML editor <% %> Not recommended. ASP tags support was added in 3. 0. 4 Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Getting Started 2. n Simple HTML Page with PHP The following is a basic

Getting Started 2. n Simple HTML Page with PHP The following is a basic example to output text using PHP. <html><head> <title>My First PHP Page</title> </head> <body> <? php echo "Hello World!"; ? > </body></html> Copy the code onto your web server and save it as “test. php”. You should see “Hello World!” displayed. Notice that the semicolon is used at the end of each line of PHP code to signify a line break. Like HTML, PHP ignores whitespace between lines of code. (An HTML equivalent is <BR>) Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Getting Started 3. n Using conditional statements Conditional statements are very useful for displaying

Getting Started 3. n Using conditional statements Conditional statements are very useful for displaying specific content to the user. The following example shows how to display content according to the day of the week. <? php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday. ”; } ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Getting Started 3. Using conditional statements The if statement checks the value of $today_dayofweek

Getting Started 3. Using conditional statements The if statement checks the value of $today_dayofweek (which is the numerical day of the week, 0=Sunday… 6=Saturday) n n If it is equal to 4 (the numeric representation of Thurs. ) it will display everything within the first { } bracket after the “if()”. If it is not equal to 4, it will display everything in the second { } bracket after the “else”. <? php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday. ”; } ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Getting Started 3. Using conditional statements If we run the script on a Thursday,

Getting Started 3. Using conditional statements If we run the script on a Thursday, we should see: “Today is Thursday”. On days other than Thursday, we will see: “Today is not Thursday. ” <? php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){ echo “Today is Thursday!”; } else{ echo “Today is not Thursday. ”; } ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n n PHP is a great way to implement templates on your website.

Examples n n PHP is a great way to implement templates on your website. How to implement a simple page counter Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n n Step 1: Universal header and footer in a single file Create

Examples n n Step 1: Universal header and footer in a single file Create a file called header. php. This file will have all of the header HTML code. You can use Front. Page/Dreamweaver to create the header, but remember to remove the closing </BODY> and </HTML> tags. <html><head> <title>UCR Webmaster Support Group</title> <link rel="stylesheet" type="text/css" href=“mycssfile. css"> </head> <body> <table width=80% height=30> <tr><td> <div align=center> Page Title </div> </td></tr></table> Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n Step 2: Universal header and footer in a single file n Next,

Examples n Step 2: Universal header and footer in a single file n Next, create a file called footer. php. This file will have all of the footer HTML code. <table width=80% height=30> <tr><td> <div align=center> UC Riverside Department<BR> <a href=mailto: someuser@ucr. edu>someuser@ucr. edu</a> </div> </td></tr></table> </body> </html> Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n n Step 3: Universal header and footer in a single file This

Examples n n Step 3: Universal header and footer in a single file This is the basic template that you will use on all of the pages. Make sure you name the files with a. php extension so that the server will process the PHP code. In this example, we assume the header and footer files are located in the same directory. <? php // header include(“header. php”); ? > Insert content here! <? php // footer include(“footer. php”); ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples Benefits: - Any changes to header or footer only require editing of a

Examples Benefits: - Any changes to header or footer only require editing of a single file. This reduces the amount of work necessary for site maintenance and redesign. - Helps separate the content and design for easier maintenance Header Page 1 Content Page 2 Content Page 3 Content Page 4 Content Page 5 Content Footer Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n Step 1: Simple Page Counter n Download the counter file webcounter. txt

Examples n Step 1: Simple Page Counter n Download the counter file webcounter. txt onto your machine n Upload the webcounter. txt file onto your web server (via FTP, Win. SCP, etc) n Change the file permissions of the webcounter. txt file to 777 to allow the counter file to be updated. Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n Step 2: Simple Page Counter n Copy this code into a page

Examples n Step 2: Simple Page Counter n Copy this code into a page where you want a counter. <? php $COUNTER_FILE = “webcounter. txt"; if (file_exists($COUNTER_FILE)) { $fp = fopen("$COUNTER_FILE", "r+"); flock($fp, 1); $hits = fgets($fp, 4096); $hits += 1; fseek($fp, 0); fputs($fp, $hits); flock($fp, 3); fclose($fp); } ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n n Step 3: Simple Page Counter Next, output the counter value using

Examples n n Step 3: Simple Page Counter Next, output the counter value using PHP. Copy this line after the main block of code. This page has been viewed <? php echo“$hits”; ? > times. • That’s it! The result should look something similar to: Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples n n Step 3: Simple Page Counter You can change the text around

Examples n n Step 3: Simple Page Counter You can change the text around the <? php echo“$hits”; ? > tags to your liking. <? php echo“$hits”; ? > visitors. This example shows 1. How to escape from HTML and enter PHP mode 2. How to output variables onto the screen using PHP Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples 2. n n How to output variables using PHP Echo is the common

Examples 2. n n How to output variables using PHP Echo is the common method in outputting data. Since it is a language construct, echo doesn’t require parenthesis like print(). Output Text Usage: <? php echo “Hello World”; ? > // prints out Hello World Output the value of a PHP variable: <? php echo “$hits”; ? > // prints out the number of hits Echo has a shortcut syntax, but it only works with the “short open tag” configuration enabled on the server. <? = $hits ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Examples 3. n n Other uses with echo() Automatically generate the year on your

Examples 3. n n Other uses with echo() Automatically generate the year on your pages. This will print out © 2004 UC Riverside. ©<? php echo date(“Y”); ? > UC Riverside You will need to escape any quotation marks with a backslash. <? php echo “I said ”She sells sea shells” ”; ? > Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Additional Resources n PHP Manual http: //docs. php. net/ n PHP Tutorial http: //academ.

Additional Resources n PHP Manual http: //docs. php. net/ n PHP Tutorial http: //academ. hvcc. edu/~kantopet/php/index. php n PHP Coder http: //www. phpide. de/ n JEdit http: //www. jedit. org/ n n PHP's creator offers his thoughts on the PHP phenomenon, what has shaped and motivated the language, and where the PHP movement is heading http: //www. oracle. com/technology/pub/articles/php_experts/rasmus_php. html Hotscripts – A large number of PHP scripts can be found at: http: //hotscripts. com/PHP/Scripts_and_Programs/index. html Nguyễn Quang Hùng – E-mail: hungnq 2@dit. hcmut. edu. vn

Additional Information Some of the new functions added in version 5: n Arrays: array_combine()

Additional Information Some of the new functions added in version 5: n Arrays: array_combine() - Creates an array by using one array for keys and another for its values n array_walk_recursive() - Apply a user function recursively to every member of an array n Date and Time Related: n idate() - Format a local time/date as integer n date_sunset() - Time of sunset for a given day and location n date_sunrise() - Time of sunrise for a given day and location n time_nanosleep() - Delay for a number of seconds and nano seconds n Strings: n str_split() - Convert a string to an array n strpbrk() - Search a string for any of a set of characters n substr_compare() - Binary safe optionally case insensitive comparison of two strings from an offset, up to length characters n Other: n php_check_syntax() - Check the syntax the specified Nguyễn Quangof. Hùng – E-mail: file hungnq 2@dit. hcmut. edu. vn n php_strip_whitespace() - Return source with stripped comments and whitespace