-
what does php stand for?
hypertext preprocessor
-
describe php
- a server-side scripting language
- allows you to create dynamic web pages
-
script vs. programming languages
- script: interpreted line by line every run
- programming language: compiled from source code to binary then delivered as a program
-
scripting vs programming language variables
- scripting: typeless
- programming language: declared as a particular type and have memory allocated to them
-
using constants in php
- define()
- define("PI", 3.14);
-
echo vs print
- echo:faster but can't be used in complex expressions. does not return a value.
- print: returns a value (1) and can be used in complex expressions
-
used to concatenate strings....
used to append another string...
-
3 types of arrays in php
- numeric
- associative
- multidimensional
-
numeric array
- an array with a numeric index
- $arr[0] = 'Sam';
-
associative array
- an array where each ID key is associated with a value
- $prices=array('Honda'=>20000, 'BMW=>40000);
-
multidimensional array
- an array containing one or more arrays
- $families = Array('Griffin' => Array( 'Peter', 'Louis'), 'Quagmire' => Array('Glenn'));
-
are php functions case sensitive?
no
-
php: assign by reference
there is no memory being accessed, they are merely copying each other.
-
print_r()
- adds <pre> tags
- this displays the information in human readable form
-
$_GET
- a superglobal array
- used to collect values from a form
- visible to everyone by showing up in the url
- 256 character limit
-
$_POST
- superglobal array
- collect values from a form
- insvisible to everyone
- no limits
-
$_REQUEST
- superglobal array
- used to get the result of data sent with $_GET, $_POST and &_COOKIE
-
$_SERVER['PHP_SELF']
- returns everything after / upto another / or ?
- using the url: http://example.com/testdir/test.php?my=5
- the result would be: /testdir/test.php
-
enctype
specifies how form-data should be encoded before sending it to the server
-
two main types of filtering
filter_var() uses: validation, sanitation
-
require() vs include() failure handing
- require() produces a warning
- include() results in a fatal error
-
require()
includes and evaluates a specific file.
-
output control
allows to to tell php when to submit information to the browser
-
ob_...()
- means it's using buffer
- ... could be start, flush etc.
-
encoding
rules that pair each character with a number and determine how to store it and manipulate it.
-
unicode
a character set that includes all characters in every written system.
-
UTF-16
- in memory string
- java, .net, windows
-
UTF-6
- storage and protocols
- .txt, .html. xml
-
iconv
- php multibyte
- uses an external library
- less protable
-
mbstring
- multibyte
- library bundled with PHP
- more portable
-
2 php multi byte extensions
-
relational database
- RDB
- data is organized into table
-
relational
- refers to the relationship between columns within a tableĀ
- also links between tables
-
php variables
- can only contain letter, digits and underscores
- no digit directly after $
- case sensitive
|
|