• PHP code samples

  • __php_elephant.gif

    Free php code example (code source). Useful classes like paging, Sql Wrapper, regular expressions, Backpropagation in php, and many other useful scripts.

 

Artificial Intelligence Neural Network Backpropagation

A demostration of a multilayer neural network with backpropagation.

See more..

 

Image demonstrating Lorentz attractor

Chaos Theory and Lorentz attractors: check out for this graphic representation of Lorentz attractor using PHP.

See more..

 

Artificial Intelligence to solve the multiplication table

A demostration of a multilayer neural network with backpropagation to solve the multiplication table problem. Preprocessing data by normalizing with min-max formulas.

See more..

 

Array replace patterns

Regular expresions with arrays

See more..

 

Get MySQL Field Names From Query with PHP

Print a dynamic table with fields names in the header from any MySQL query.

See more..

 

Find XML Nodes and Attributes with PHP SimpleXML Recursive Functions

How to find XML nodes and attributes by name with PHP SimpleXML traversing recursively an xml file

See more..

 

A Paging Class

Have you ever had need of a simple paging class? A class to page database records.

Simple but efficient!

See more..

 

Regular Expressions

See email validation sample with the function preg_match

See more..

 

Truncate decimals without rounding

To truncate a number to two decimal places without rounding. Try this:
((int)($myNumber*100)/100)

See more..

 

PHP MySQL Recursive Function

Simple php recursive function to loop throgh all categories in a hierachical relantionship database.

See more..

 

Session variables lost

Why session variables are lost when redirecting to an url using the header function?

See more..

 

Emacs on a Linux Console

How to get the best colors in emacs console mode?

See more..

 

Installing Apache,PHP 5, and MySQL 5 for Windows

Installing Apache 2.2.4, PHP 5.2.4, and MySQL 5.0.45

Or easy Steps to have WAMP in your windows server. (Tested on Windows XP)

See more..

 

PHP5 and Sessions

When migrating from php 4 to php 5 the session values are lost from one page to other

See more..

 

Php Export Excel made simple

Here is a very simple way to export your data into an excel file. No need to write .xsl files, nothing really, just create plain html.

See more..

 

Encrypting string with PHP using mcrypt

A simple class to encrypt-decrypt strings

See more..

 

Parsing XML elements and attributes with PHP

Use the PHP class XMLReader to parse an XML file and read elements and attributes

See more..

 

The Padovan sequence

PHP Script that demons,trate the Padovan sequence

See more..

 

PHP Export CSV made simple

Export data to an CSV file and output to browser

See more..

 

php days between two dates

A function to calculate the number of days between two dates

See more..

 

PHP Sql Wrapper Class

A simple class to handle database operations when you don't have PDO. It uses Singleton to handle an unique database connection.

See more..