Archive

- Posts Tagged ‘PHP’

PHP: Using Callback Function/method

Before going into the details syntax of using Callbacks in PHP, we need a use case where we can use callbacks. Many PHP build-in functions uses callback function and then we need to just pass our callbacks. WordPress also accepts callback at many places. Here the example presented gives us… (Continue)

XML in PHP (version 5+)

PHP 5 has many XML extensions. Each one has its own advantages and disadvantages. Which one to select for our task. Suppose you know some XML techniques and can dive into the XML extension whichever is suitable then you first need to know all the available extensions. I tried to… (Continue)

Stateful Ajax experimentation

Here is a JavaScript, PHP and HTML written during experiment with stateful Ajax. The code provide stateful Ajax. It maintains the stateful Ajax as you traveled the path. file1 and file2 is separate PHP file that Ajax loads. +ve Counter is provided by one PHP file and -ve Counter is… (Continue)

Observer Design Pattern – Usage and Example in PHP

This is another post regarding design patterns. This time it is observer design pattern which is helpful in developing system having plugin facility and subscription based services. I will present example in PHP for Observer design pattern which is taken from Aaron Saray's Professional PHP Design Patterns book on design… (Continue)

Strategy Design Pattern – Usage and Example in PHP

Strategy design patterns is a behavioral design pattern that allow you select a algorithm from the available algorithms at the runtime. Client object can take any algorithm based on its need. It lets you choose strategy independently from client that use it. Each strategy encapsulated in itself, so client object… (Continue)

PHP: Get Headers using cURL

How to get headers using cURL in PHP? We can know the health of a web page without visiting a link. We can get the information about link status whether is returning response 200 or it is moved it somewhere else or it is dead. <?php /** * Script to… (Continue)

PHP and Mysql SQL Injection Example

SQL injection is one very common attack on PHP application. Earlier PHP has magic_quotes_gpc() On by default but now after version 5.3 it will be deprecated. So, whatever security was available due to magic quotes will go after PHP version 5.3. For the attack, attacker need to know a little… (Continue)

Zend Framework Tutorial: Following another Quickstart

I am following another quickstart tutorial for Zend Framework written by Rob Allen. This tutorial is far better than the tutorial on official zend framework site. I am also little experienced after following super tutorial on Zend Framework so it is gonna easier anyway. I thought to write all commands… (Continue)

Zend Framework: Creating a Form

Finally this Zend Framework quickstart/sample tutorial is over. At this last step of tutorial, I met error in very first command. The first command is: zf create form Guestbook. Error is: PHP Fatal error: Call to a member function search() on a non-object in .. when I used this command:… (Continue)

Python for PHP Developers

From long time I was thinking about Python, and I spent some time with Python today. I cannot say it is good programming language or not, but I see lots of activity in Python field. I was impressed after seeing Python in Google App language list. I  followed this article… (Continue)