Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Php And Mysql

Mind-Map ... don't know the exact meaning of that although

Chaitanya Thota

on 18 February 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Php And Mysql

Map Php And Mysql String Manipulations Strings trim(), ltrim(), rtrim() Always advisable.

Use trim as much as possible. When the system becommes big, every whitepace is valuable Basics Basics Chapter-1 Tags :
<?php ?> , <? ?>, <script language='php'> </script> Comments : //, /* */ form Variables : $_POST, $_GET,$_HTTP_POST_VARS
Zend : $this->_getParams() , _getAllParams "." - concatenation multi line echo :
theEnd loosely typed,
typecasting also possible Superglobals : $GLOBALS, $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV, $_REQUEST, $_SESSION operators : normal rules apply
reference Operator : $a=&$b Execution Operator: ` ls -a` Type-testing functions is_array
is_double, is_float, is_real
is_long, is_int, is_integer
is_string, is_bool, is_object
is_resource ?????
is_null, is_scalar is_callable, is_numeric
isset, empty Iterations and Conditionsl: if, if ... else, switch

for, foreach, while, do....while declare(ticks=n) {}: repeats a particular code snippet every n lines File Operations fopen : File Operations $_SERVER['DOCUMENT_ROOT'], ZEND : APPLICATION_PATH windows : \ , unix : / in path specification modes : r, w, r+ or w+,

cautious write : x, x+;

append open : a, a+;

windows: b, t . fwrite, fread
file_get_contents fclose feof Reading per line fgets($fp, bytes-limit) fgetss : strips php and html tags fgetcsv($fp, limit, dilimiter) Reading whole File : readfile(path) fpassthru($fp) file(path) character read : fgetc() Other useful functions : file_exists(path)
unlink(path) File pointer Location :

rewind($fp) - resets file-pointer
ftell($fp) - location of file-pointer
fseek($fp, offset, starting-point) 1) trim - 2) nl2br, sprintf, printf, ucfirst, ucwords - nl2br - when printing to a browser, for new lines converts new line characters to <br /> printf :- more customisable, similar to c, prints to browser.
sprintf :- same as printf, returns a formatted string to us and prints to browser. strtoupper, strtolower,
ucfirst :- capitalizes the first character of a string
ucwords :- capitalizes the first character of every word 3) addslashes and stripslashes :- Whenever adding user data to database, always a muust to escape special characters if using direct sql statements.

addslashes - adds backslash before special characters

stripslashes - removes escape characters, a must when displaying data to a page 4) explode, implode, strtok :- explode(separator, input, limit)
returns an array of pieces
limit the number of array pieces with limit implode(joiner, input) :- opposite to explode strtok(input, separator) - returns array splitting the input with separator character-wise, not as a full separator string, second time calling :- strtok(separator) maintains pointer to the input 5) strcmp, strcasecmp, strnatcmp :- substr( string, start, length) :- returns input from start to length.

start and length can be positive or negative strcmp(str, str) - compares 2 strings, case-sensitive,
equal - 0, str1>str2 - +ve , str1<str2 - -ve strcasecmp(str, str) - same as strcmp , case-insensitive strnatcmp(str, str) - same as strcmp, uses natural ordering when comparing strings.

'a2' > 'a12' - normally , but 12 > 2,
natural ordering 'a2'<'a12' 6) strstr, strchr, strrchr, stristr :- strstr(hay, needle) :- returns haystack from the first occurence of needle, else false
case-sensitive strchr === strstr stristr - same as strstr, case-insensitive strrstr - returns string from the last occurrence of needle 7) strpos, strrpos, str_replace, substr_replace :- strpos(hay, needle, offset) - returns first occurring position of needle from offset strrpos :- returns position of last occurence faster than substr str_replace(replaced array, replacement array, hay array, count) :-
replaces the 1st array of substings of the haystack array with the respective replacement sub-strings for a total of count number of times substr_replace(string, replacement, start, length) :-
replaces the string from start with replacement string upto length.
length = 0 , inserts ; length +ve , number of charactes to be replaced; -ve , the character at which it stops cunting from end of string 8) regular expressions :- POSIX style of regular expression. '.' :- any single printable character. example : .eat ---- heat, beat, seat, @eat
[] :- range of characters that can be used : [b-g]eat ---- heat, beat
can be used as [aeiou] or [a-z1-9] ^ :- when used in square brackets, value of not, outside , denotes the start of the string predefined character classes : [[:alnum:]] - alphanumeric
[[:alpha:]] - alphabetic
[[:lower:]] - lowercase
[[:upper:]] - uppercase
[[:digit:]] - decimal
[[:xdigit:]] - hexadecimal
[[:punct:]] - punctuation
[[:blank:]] - tabs and spaces
[[:space:]] - whitespaces
[[:cntrl:]] - control characters
[[:print:]] - printable
[[:graph:]] - printable except space repitition : + - repeat one or more times
* - repeat zero or more times

[a-z]+ , [a-z]*, (more )*potatoes - more pota..., more more pota... {} - for range of repetitions (more){1,2} - repeats once or twice
(more){1} - reeats once ^ - beginning of the string
$ - end of the string ed | ad :- branching special characters : special characters :
have too be denoted by using backslashes \
for regular expressions advisable to use regular expressions always in single quotes
otherwise the slash problem occurs with double quotes for double quoted php special characters : 4 slashes to represent a single slash ereg(pattern, search, matches) :- looks for pattern in search, return matched strings as array eregi - case-insensitive ereg_replace(pattern, replacemennt, search)
eregi_replace - case insensitive
split(pattern,input, max) :-
splits using pattern max number of times and returns an array operations : Regular OverView \ : escape
^ : match at start
$ : match at end
. : match any char except new line
| : branch
( : start subpattern
) : stop
*: repeat 0 or more
+: repeat 1 or more { : start quantifier
} : stop quantifier
? : mark subpattern as optional
Full transcript