When you have a set of variables or want to make your code simpler, you will use a function. Creating a function is really easy all you have to do is write something like:
function myFunctionName() {
//Function data
}
When you have a set of variables or want to make your code simpler, you will use a function. Creating a function is really easy all you have to do is write something like:
function myFunctionName() {
//Function data
}
This is just an example of a config file which connects to a database for those who need it:
DEFINE (‘DB_USER’, ‘username’);
DEFINE (‘DB_PASSWORD’, ‘password’);
DEFINE (‘DB_HOST’, ‘localhost’);
DEFINE (‘DB_NAME’, ‘database name’);
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die (‘Could not connect to MySQL: ‘ . mysql_error());
@mysql_select_db (DB_NAME) OR die(‘Could not select the database: ‘ . mysql_error() );
The explode function in php is very simple to use. The syntax is something like this:
explode( string seperator, string str );
And what the explode() function will do is get the string str as an array and then it will return each “word” separated by the first parameter as it’s own array element.
Read the rest of this entry »
Just added my blog… I’ll start writing tutorials soon…