PHP: Easily create PDF on the fly

Here, I will be writing about two pdf creation PHP Classes. They are FPDF and TCPDF. With these classes, you can quickly, easily and effectively generate PDF files. FPDF is smaller in size compared to TCPDF. But, in functionalities, TCPDF wins. TCPDF has lots of features and functionalities. If you want very advanced features in … Read more

phpThumb(): The best PHP thumbnail image generator

As far as I see, I find phpThumb() as the best of all PHP thumbnail image generator. It has lots of thumbnail generation features. You can create thumbnail in a number of ways with phpThumb(). phpThumb() uses the GD library to create thumbnails from images (JPEG, PNG, GIF, BMP, etc) on the fly. Basic functionality … Read more

PHP: How to get stock quote data from Yahoo! Finance? (Complete Code and Tutorial)

In this tutorial, I will be showing you how you can fetch any company’s data from Yahoo! Finance. INTRODUCTION First of all, let us see the stock quote data of top tech companies on Yahoo! Finance. View the basic Google stock chart on Yahoo! Finance: http://finance.yahoo.com/q?s=goog For eBay: http://finance.yahoo.com/q?s=EBAY For Amazon: http://finance.yahoo.com/q?s=AMZN For Apple: http://finance.yahoo.com/q?s=AAPL … Read more

PHP: Read Write CSV

In this article, I will be showing you how to read and write CSV file with PHP. I have used PHP function fgetcsv to read CSV fields and fputcsv to write on CSV file. fgetcsv — Gets line from file pointer and parse for CSV fields. fgetcsv() parses the line it reads for fields in … Read more

PHP: How to get Main or Base URL?

Suppose you are on a page : http://example.com/category/php/ Now, the base URL or the main URL for the above link is : http://example.com Similarly, in the case of local machine (localhost), Suppose you are in the page : http://localhost/myproject/index.php?id=8 Here, the base or main URL is : http://localhost/myproject Below is the code to get main … Read more

PHP: Parse Unparse String Array

Here is a quick tip on parsing and unparsing string and array in PHP. You can parses the string into variables by using the parse_str PHP function. Using parse_str function void parse_str ( string $str [, array &$arr ] ) $str = The input string. $arr = If the second parameter arr is present, variables … Read more

PHP: How to get integer or decimal from a string?

Suppose, I have a string with text and number and I only want the number. I don’t want the characters and text of the string. Here is the way out:- In this example, you will get only integer. It will omit all characters and text from the string. $string = 'Nrs 89,994,874.0098'; echo preg_replace("/[^0-9]/", '', … Read more

PHP: Simple and easy way to format URL string

Here, I will be showing you a simple and easy one line code to format URL string with PHP. By URL string, I mean the url key in any Search Engine Friendly URL. I have used preg_replace function to do so. preg_replace($pattern, $replacement, $string) preg_replace function performs a regular expression search and replace. This will … Read more

Simple and easy jQuery tabs with AJAX and PHP

In this article, I will be showing you how to create jQuery AJAX tabs in a very simple and easy way. View Demo || Download Code Here, tabs.php contains the php code which contains data to be displayed. <?php $p = $_GET['id']; switch($p) { case "1": echo '<h2>Google</h2>Content goes here !<br style="clear:both;" />'; break; case … Read more