PHP

Post

Browsing posts in PHP

1 comment   |   PHP
PHP 5: Recursively move, copy or delete files and folders

PHP 5: Recursively move, copy or delete files and folders

1 comment   |   PHP
PHP library for parse and retrieve information from XLS files

PHP library for parse and retrieve information from XLS files

It’s realy cool library, you don’t need PEAR library, or other’s files. Now you can parse your xls to array. Example of usage: <?php require_once 'reader.php';   $filename="test.xls"; $prod=parseExcel($filename); echo"<pre>"; print_r($prod);   function parseExcel($excel_file_name_with_path) { $data = new Spreadsheet_Excel_Reader(); // Set output Encoding. $data->setOutputEncoding('CP1251'); $data->read($excel_file_name_with_path);   $colname=array('name','price','old_price','in_price','descr','status','sku','pos','stock','in_name','manufacturer','supplier','photo');   for ($i = 1; $i <= $data->sheets[0]['numRows']; ...

Comments   |   PHP
CS-CART: Random banner rotation

CS-CART: Random banner rotation

Litle hack to rotate many banners in one block. First of all you need to add all your banners at block, and then open this file: /skins/THEME_NAME/customer/addons/banners/blocks/original.tpl

Comments   |   PHP
PHP-based admin tool to manage SQLite databases

PHP-based admin tool to manage SQLite databases

phpLiteAdmin is a web-based SQLite database admin tool written in PHP with support for SQLite2 and SQLite3. Following in the spirit of the flat-file system used by SQLite, phpLiteAdmin consists of a single 100KB source file that is dropped into a directory on a server and then visited in a browser. Setup is as simple ...

Comments   |   PHP
PHP automate creation of images for CSS sprites.

PHP automate creation of images for CSS sprites.

I use imagefilter to create images for CSS sprites on the fly. This is part of my code:

1 comment   |   PHP, Useful
Regular expression: find all flash elements

Regular expression: find all flash elements

This small regular expression help you to find all flash elements in $body variable. preg_match_all("/<object[^>]*?>.*?<\/object>/si",$body,$out);

Comments   |   PHP
Trim long words

Trim long words

1 comment   |   PHP
Object-Oriented PHP: Working with Inheritance

Object-Oriented PHP: Working with Inheritance

Learn how inheritance works in PHP. This tutorial explores the concept of parent and child classes; overriding methods; final classes; abstract classes, and interfaces. Example code included. We’ll look at the following topics in this article: The concept of inheritance, and why it’s so useful How one PHP class can inherit from another How a ...

2 comments   |   PHP, Useful
Passing variable number of arguments to a PHP function

Passing variable number of arguments to a PHP function

function test () { $args = func_get_args(); //get all arguments into array foreach($args as $num=>$val) { echo '<p>'.$val.'</p>'; //print argument } } The same useful functions: func_num_args() -get num of passing arguments func_get_arg(n) - get argument by it number

Comments   |   PHP
Turn off deprecated errors in php 5.3

Turn off deprecated errors in php 5.3

Many admins after updating to PHP 5.3 see this errors, to turn off them use error_reporting(E_ALL ^ E_DEPRECATED);