Easiest way to install and start programming with PHP: Run PHP program using XAMPP
To begin Programming in PHP for web development, the very first obstacle one finds is:
How to install PHP and run PHP Program (or file)? What's the easiest way?
Answer: The easiest way to install PHP and run PHP Program (files ending in
.php) for the first time (for web development) is using the software bundle named XAMPP. There are other similar software bundles that can install PHP and run a PHP file, but:
Continue reading "How to run PHP Program for the first time? use XAMPP."
Learn key differences among the PHP constructs: include vs. include_once vs. require vs. require_once & use them correctly.
PHP programmers regularly use the functions (or more appropriately known as language constructs) like
require_once to insert useful files in the flow of execution. Although these constructs are used quite interchangeably, there are actually significant differences among them. Many programmers don't know well enough about these differences. I hope this post will help them towards a better coding practice.
Continue reading "PHP include vs. include_once vs. require vs. require_once"
Learn how to handle PHP and MySQL date formatting correctly.
If you ever try to format date in PHP and MySQL, using date (datetime or timestamp) value directly from MySQL to PHP date() function, then you'll get a Notice level error, something like this:
Notice: A non well formed numeric value encountered in ... .. .
Additionally, PHP date() will always return January, 01 1970 if MySQL date is directly used. It means, there is a difference between date in PHP and date in MySQL (i.e. they are not compatible). PHP date function accepts Unix Timestamp, which is different from MySQL date types (DATE, TIME, DATETIME, TIMESTAMP etc.)
Continue reading "Use PHP MySQL date format correctly"