PHP script to import a csv file using fgetcsv() and and a simple foreach loop to display the content in a table.
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts
Saturday, 22 September 2012
Friday, 21 September 2012
Extracting email addresses from a text file using PHP REGEX
This is a simple yet effective way to extract email addresses from a .txt file.
The script reads the text file and then uses a REGEX expression to extract the email addresses from the content of the file.
Saturday, 21 July 2012
PHP Language Structure
DATA TYPES
Data types in PHP are generally divided into two categories namely scalar and composite. A scalar variable contains only one value at a time and PHP supports four scalar types:- boolean – can either be true or false.
- int – signed (can be positive or negative) numeric integer value.
- float – signed floating point value.
- string – collection of characters.
Sunday, 4 March 2012
PHP: Variable Handling Functions
- debug_zval_dump — Dumps a string representation of an internal zend value to output
- doubleval — Alias of floatval
- empty — Determine whether a variable is empty
- floatval — Get float value of a variable
- get_defined_vars — Returns an array of all defined variables
- get_resource_type — Returns the resource type
- gettype — Get the type of a variable
- import_request_variables — Import GET/POST/Cookie variables into the global scope
PHP: Array Related Functions
- array_change_key_case — Changes all keys in an array
- array_chunk — Split an array into chunks
- array_combine — Creates an array by using one array for keys and another for its values
- array_count_values — Counts all the values of an array
- array_diff_assoc — Computes the difference of arrays with additional index check
- array_diff_key — Computes the difference of arrays using keys for comparison
- array_diff_uassoc — Computes the difference of arrays with additional index check which is performed by a user supplied callback function
- array_diff_ukey — Computes the difference of arrays using a callback function on the keys for comparison
An Introduction to PHP Functions
A function is an input/output “machine”. A function accepts values, processes them and then returns an action.
1. Defining a Function
Functions are defined by using the functions statement :
function someFunction($argument, $argument){
//function code here
}
Subscribe to:
Posts (Atom)

