- Posts Tagged ‘PHP Script’

Alex Gorbatchev’s Syntax Highlighter to PrismJs

Here is big help for those who are using Alex Gorbatchev's Syntax Highlighter and want to use lightweight Syntax Highlighter called prismjs for their blog or website. This code is in written in PHP and WordPress is also in PHP, so those who are using WordPress can easily use this… (Continue)

Play with YQL: HTML Scraping using YQL and PHP

Here is a quick post. It is a product created from a play with YQL (Yahoo Query Language). YQL is very powerful in scrapping HTML from any page on web. Yahoo YQL and Yahoo Pipes are very powerful tool. Yahoo pipes is very good for merging Feed. This YQL play… (Continue)

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)

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 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)

Singleton Design Pattern – Usage and Example in PHP

Singleton design pattern is useful when we need a one-of-its-kind object. Only single instance of a single pattern class is possible. This kind of class is generally useful in resource handling or in other use case where we need single instance of Object. Database connection handling is one such example.… (Continue)

Zend Framework: Create a Model and Database Table

Here is another article based on Zend Framework's documentation about creating model and database table. I have noticed that I am on worst documentation ever I read. Yes, Zend Framework's doc about quickstart tutorial is very badly written. If I remember it correctly then Symfony document was far better. At… (Continue)

PHP Date / Time Function: strtotime

PHP has number of date and time functions. One is date(), which I feel, is most used date and time function. Time() function can be another most used time function. But the most interesting date and time function I feel is the function strtotime(). It is interesting as it understand… (Continue)

PHP + CURL: Get Returned Content Mime Type

Did you ever tried to get mime type of the returned content in CURL! I was writing a small application for something and thought to know the Content-Type (mime type) of the response data returned by CURL's exec(). Before thinking of anything else, I habitually started Goggling and found this… (Continue)