0% found this document useful (0 votes)
76 views5 pages

PHP Topics

The document discusses various SQL statements and clauses like CREATE TABLE, ALTER TABLE, SELECT, INSERT, UPDATE, DROP, DELETE, LIKE, LIMIT, GROUP BY, HAVINGS, IN, BETWEEN and JOIN. It also discusses storage engines and provides examples of creating a table and performing inserts, updates, selects and joins. It then discusses PHP functions for strings, arrays, regular expressions, functions, web programming and OOP concepts.

Uploaded by

anup198921
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views5 pages

PHP Topics

The document discusses various SQL statements and clauses like CREATE TABLE, ALTER TABLE, SELECT, INSERT, UPDATE, DROP, DELETE, LIKE, LIMIT, GROUP BY, HAVINGS, IN, BETWEEN and JOIN. It also discusses storage engines and provides examples of creating a table and performing inserts, updates, selects and joins. It then discusses PHP functions for strings, arrays, regular expressions, functions, web programming and OOP concepts.

Uploaded by

anup198921
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

MySQL sql statement create, alter, select,insert,update,drop,delete clause's Like, Limit, Group by ,Havings, IN, between Join's basic

knowledge of Storate Engines Answers CREATE TABLE Persons

( P_Id int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ) ALTER TABLE Persons ALTER COLUMN DateOfBirth year SELECT column_name(s) FROM table_name INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, 'Tjessem', 'Jakob') UPDATE Persons SET Address='Nissestien 67', City='Sandnes' WHERE LastName='Tjessem' AND FirstName='Jakob' DROP TABLE table_name SELECT * FROM Persons WHERE City LIKE '%tav%' SELECT * FROM Persons WHERE LastName IN ('Hansen','Pettersen') SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons INNER JOIN Orders ON Persons.P_Id=Orders.P_Id ORDER BY Persons.LastName

http://en.wikipedia.org/wiki/Database_engine PHP 1).String Length of string Strlen


<?php echo strlen("Hello world!"); ?>

Comparing, searching and replacing strstr,strcmp,substr,stricmp,strcasecmp,strreplace, strspn, trim, chunk, split, spliti, chop,
strstr(string,search) -> by string case sensitive by number

strcmp(string1,string2) -> stricmp

substr(string,start,length) ->

there is no function like that -> Replaces some characters in a

stcasecmp(string1,string2) -> case insensitive str_replace(find,replace,string,count)


string (case-sensitive)

strspn(string,charlist,start,length)-> The strspn() function returns the


number of characters found in the string that contains only characters from the charlist.

trim(string,charlist) -> Strips whitespace from both sides of a string chunk_split(string,length,end) -> chunk_split($str,1,".") The
chunk_split() function splits a string into a series of smaller parts

chop() -> alias of trim

sorting sort, ksort, arsort, rsort, asort, natsort sort() -> Sorts an array ksort() -> Sorts an array by key = ksort(array,sorttype) arsort() -> Sorts an array in reverse order and maintain index association
asort() -> Sorts an array and maintain index association

natsort() -> sort an array by natural order algorithm

Formating strings printf,scanf

printf -> Outputs a formatted string


scanf ->

Regular Expressions identifying of characters of regular expression functions to use regular expression, like preg_match, preg_match_all, preg_replace
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3); preg_match_all($pattern, $subject, $matches); <?php $string = 'The quick brown fox jumped over the lazy dog.'; $patterns = array(); $patterns[0] = '/quick/'; $patterns[1] = '/brown/'; $patterns[2] = '/fox/'; $replacements = array(); $replacements[2] = 'bear'; $replacements[1] = 'black'; $replacements[0] = 'slow'; echo preg_replace($patterns, $replacements, $string); ?>

2).Array Create array,


array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);

multi dimensional array


$families = array ( "Griffin"=>array ( "Peter", "Lois", "Megan" ), "Quagmire"=>array ( "Glenn" ), "Brown"=>array ( "Cleveland", "Loretta", "Junior" ) );

Comparing,
array_diff() array_diff_assoc() array_diff_key() array_diff_uassoc() array_diff_ukey()

array_intersect()

counting,
array_count_values()

searching, deleting elements, combine, intersect, flipping, reverseing, explode,implode, list, slicing Array iteration, array pointer, array walk, Array shift/unshift, Array push/pop 3).Function create function referenced functions and referenced parameter scope of function mail function date function file handlers file read,file write, file upload, create dir, fopen 4).Web Programming Global variable $_SERVER, $_GET, $_POST, $_REQUEST, $_SESSION, $_COOKIES, $_GLOBAL, $_FILES HTTP authentication

header, location, caching, compressing function(ob_start,ob_flush...)

5).OOP PHP OOP Fundamentals, class declaration, access specifiers(public, private, protected ), final, method declaration, magic functions Constants, Static Methods and Properties, reference method's and proprieties Interfaces & Abstract class, Exceptions, try.. catch, standard exception classs PDO - php data objects standard pdo classes Magic Methods collections

You might also like