Arrays are one of the most used properties in php, arrays are
like a container they are very simple they can can be indentified by a
key or a value and the value can also be an array and that’s called a
multi-dimentional array.
Cre...
You can sort an array in many different ways using PHP using many different functions, here are a few.
sort($array);
asort($array);
ksort($array);
These three different sorting functions all can be sorted in ascending order.
The rever...
This is a very easy to install pagination class that takes a PHP array and parses it into an array.
To install into one of your personal array’s start by including the main file and creating the pagination object.
<?php
include ...
In this day and age and taking into consideration the evolution of the web, allot of things are overlooked when programming and one of the main subjects I see commonly being overlooked” is validation.Validation isn’t th...
A simple way of making all letters into capitals is to use PHP’s inbuilt function strtoupper, can be done like this.
echo strtoupper(‘Hi, i am going to be all in caps in just one mo’);
And it will print …
...
Sometimes it is convenient to be able to have variable variable
(var vars) names. That is, a variable name which can be set and used
dynamically.Var vars can be very handy, you can use them to associate a name to a variable.
...
I am assuming that you already have PHP installed and configured on your web server. If you don’t, then you need to goto http://www.php.net to find information on that. Once you have everything setup and working then we can move on...
Variables are used for storing data/values for use later in your
script. This is a easy way to name and hold on to any value you want
for later use. There are a few things you need to know
about variables in PHP. First, all variables in ...
Here is another PHP tutorial for PHP Arrays. Gotta love them and use them.This one should be a little more simple than my first Array tutoiral.At some point are another you will run into arrays in PHP or need to
use them yourself. At fir...
In PHP you sometimes need your script to run different code if a
condition it true or false. This is where the if/else statements come
in to play. There is also a elseif statement that you may use when
multiple conditions are true, we wi...
In PHP a funciton is basically a hunk of code that you can call on at
anytime to execute. You have already used alot of the built-in
functions such as echo(). The great thing about a function is that once
you write one, you can call it f...
When working with files in PHP you must be careful, this can be very
dangerous to your files and to your server if not done properly. PHP
has a lot of built-in functions to handle files, which come in handy.
File handling can be useful w...
The purpose of this tutorial is to show you how to connect to a MySQL database using PHP. Yippie!
PHP Code Example:
<?// database.php// First we will set our variables$db_host = ̶...
Stripping Slashes
If you need to strip all slashes from user input, such as a username or something along that line, this is how you would do it:
PHP Code Example:PHP Code Example:
<?/ $username is the inp...
This is a very good practice and secures your scripts better if you strip the use of HTML tags from user input.
Lets just say you have a form that lets your users make a post to your
site. By default they could post something like thi...
The focus of this tutorial is to show you how to make a very simple PHP
hit counter. The main drawback of this counter is that it counts
page views not unique hits. If you really want to track your visitors go get Google analytics. But ...
The purpose of this tutorial is
to show you how to create a very simple guestbook using PHP and a MySQL
database. So lets get started:
Creating a database:
First thing we need to do is to create our mysql database. You can use
the...
In this tutorial I am going to show you how to create one of those cool
and sometimes annoying little verification images you see on forms you
fill out. Where the image displays a string of characters and you have
to enter them into a fi...
By now, you already know what is an array, what is a structure, and how to use bit-packaged structure. Today, we will see what are unions and when & how we can use them. How you can create your own data types using typedef and how us...
Today, we will see yet another concept present in any programming
language. Naturally, we will see why at all we need functions. How a
function is declared and defined in C++? What new terms are related
with functions which are not there...
Inline Functions
Functions with small code can be declared as inline.Wherever an inline function is called, actual function code will be replacedSyntax: Put keyword inline before function definition and not in declaration. For e.g.voi...
Before moving on further in advanced C++, it is better to ensure us
that C++ is nothing but an advanced form of C. Those of you who came
from Pascal background may have not found learning C difficult as it
was mere syntax change. But whe...
OOP encapsulates data(attributes) and functions(behaviors) into packages called classes.A class is a user-defined data type that acts as a blueprint for instantiating any number of objects of that class.Classes
have property of informati...