PHP Flashcards
PHP
- Hypertext preprocessor
- widely used open source scripting language
- PHP Scripts are executed on server
php file
- Contains text ,html, css, js and php.
- Pagep is executedon server and result is executed to browser as plain html
- Extension .php
ADV of PHP
- PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
- PHP is compatible with almost all servers used today (Apache, IIS, etc.)
- PHP supports a wide range of databases
- PHP is free. Download it from the official PHP resource: www.php.net
- PHP is easy to learn and runs efficiently on the server side
features of php
- PHP can generate dynamic page content
- PHP can create, open, read, write, delete, and close files on the server
- PHP can collect form data
- PHP can send and receive cookies
- PHP can add, delete, modify data in your database
- PHP can be used to control user-access
- PHP can encrypt data
basic syn of php
<?php
|
|
?> is syn
echo
Predefined function that is used to output the text on web page
Other array functions
- array()
- array_change_key_case_()
- array_chunks()
- array_search()
- array_reverse()
- sorting(6)
array()
creates and returns an array
syn=arrayname=array(values_ _)
array_change_key_case()
Changes the case of the all keys
syn: array_change_key_case( $arrayname, case_lower)
array_chunks()
Divides the array into smaller chunks
syn: array_chunks($arrayname_,no))
array_reverse()
function returns an array containing elements in reversed order
syn: array_reverse($arrayname)
array_search()
searches the specified value in an array. It returns key if search is successful
syn: array_search(“valuetosearch”,$arrayname)
sorting array functions
- sort()
- rsort()
- asort()
- arsort()
- aksort()
- krsort()
php functions
1.piece of the code that can be reused many times.
2.takes input as args and returns the value.
Advantages:
1. code reusability
2. less code
3. easy to understand
function declaration
function functionname()
{
//code to execute
}