Category «Learn PHP programming, training and tutorials»

PHP

Working with strings in PHP

5.0 01 In PHP a string is a set of characters, where a character is the same as a byte. How to define a string in PHP? A string can be defined in four different ways: single quoted double quoted heredoc syntax (Behaves like single quoted) nowdoc syntax (Behaves like double quoted) single quoted string …

Object oriented programming (OOP) in PHP

5.0 01 Advantages of OOP in PHP Applications written using OOP are usually relatively easy to use and understand, recommended especially for large projects, where more developers can work. Because applications are real world objects based, using OOP we can create classes, a direct mapping of things, with properties and behaviors as the real world …

PHP variables, How to define a variable in PHP?

0.0 00 Variables are used to store data, like text, numbers, etc. How to define a variable in PHP? In PHP a variable starts with the $ sign, followed by the name of the variable. Naming Variables A variable consists of two parts: the variable’s name and the variable’s value. Rules you must follow when …

Php File Handling

5.0 01 First of all, an important aspect to keep in mind when working with files, is that Windows and Mac OS X filenames are not case-sensitive, but Linux and Unix ones are. So is a good practice to assume that the system is casesensitive and use a convention such as all filenames are lowercase. …

PHP dates and times

5.0 01 time() time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) Epoch time = Unix timestamp The valid range of a timestamp correspond to the minimum and maximum values for a 32-bit signed integer, for example zero = January 1 1970 00:00:00 32bit …

PHP useful links

5.0 01 Here I will update the most interesting and useful links which I found related to php. I encourage you to fill out this list posting your favorite php links in your comments. Active forums for PHP Programmers daniweb HTTP Status Code Checker Bulk url http status checker – check status codes, response headers, …

Smart Search for PHP

5.0 01 Creating Autocomplete or Search Suggestion Functionality with PHP What is Fuzzy matching Fuzzy matching treats two words that are “fuzzily” similar as if they were the same word. In 1965, Vladimir Levenshtein developed the Levenshtein distance, which measures the number of single-character edits required to transform one word into the other. He proposed …

PHP array functions

5.0 01 List of functions that work with php arrays. array_shift() array_shift() – Shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won’t be touched. array_pop() array_pop() – …

PHP Display errors & Debug

5.0 01 To turn on error reporting 1. Set in php.ini 2. In php.code Check error logs on apache server Check errors in log file that is configured in etc/apache2/httpd.conf DEBUG Php useful debugging functions gettype($variable) – Get variable type; var_dump($variable) – Dumps information about a variable; get_defined_vars() – Return an array of all defined …