Tag Archives

Archive of posts published in the tag: sample codes

Using regular expressions to extract content

PHP provides a number of really neat regular expression functions. You can find the list of the regex function at the PHP site. But the one that I’ve had most fun with is the preg_match_all() function which I’ve been using to do content…

Parsing a URL querystring into variables in PHP

It’s common knowledge you can read variable from a URL querystring by using $_GET array in PHP, but that’s only possible if the URL is “executed” in the browser. For those who might not know, querystrings are those variable-value pairs that appears behind…

Checking a string is alphanumeric in PHP

There may be times when you need a way to check that a string only contains alpha-numeric characters. That means only alphabets A-Z and numbers 0-9. Most PHP-ers will probably use regular expressions and the function preg_match(). I will admit that regular expressions…

PHP Operators: Assignment

The main assignment operator is ‘=’, which basically assigns a value on the right to a variable on the left. If you think this is the same as an equal sign in mathematics, don’t! Think of it as a ‘assigned to’ so whatever…

PHP Operators: Maths

There are various kinds of operators used in PHP, but we’re going to start with the most basic and commonly known operator – the Math operators. What are operators? They are basically a special set of characters (or symbols, if you like) which…

Introducing PHP Variables

dsfsdf

Writing your first PHP script

Now that you know how to use XAMPP Lite, it’s time to write your first PHP script. This tutorial will guide you on writing your first PHP script, show you how the PHP syntax is used, and where to put and run your…