Archive for the 'PHP' Category

array_multisort in php

December 9, 2008

Today i have used array_multisort function of php , its very easy …
I got a array, may be assoaciative example $name_array = (
[0] = array
(
[id] => 1,
[name] = > pravin
)
[1] = array
(
[id] => 2,
[name] = > navin
)
// and so on
)
// for sorting is by name alphabetically , we will use array_multisort();
first we will [...]

Important php links

November 26, 2008

1) http://www.smashingmagazine.com/2008/11/18/10-advanced-php-tips-to-improve-your-progamming/
2) http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/#AboutMySQLandPHP
3) http://www.cs.wcupa.edu/~rkline/perl2php/#stringops

Caching in smarty

August 27, 2008

Smarty is a template mechanism which uses caching of pages , which helps our page loading quickly.
For smarty to work properly , we needed to include “Smarty.class.php”
the code is
require(“Smarty.class.php”);
$page=new Smarty();
// then to enable caching all u need to do
$page->caching=1;
// then u display the particular template
$page->display(“index.tpl”);
Now what if we want some life span for the caching [...]

How to restart apache webserver

July 23, 2008

login with root user then
$: > apachectl restart

How to install php 5.2 using IIS (Internet Information Service)

July 7, 2008

There are following steps which are to be followed to install php5.2
1) Download php5.2 from site www.php.net/downloads.php
2) Extract the folder in ur c directory and rename the folder as c:/php
3) There are ext directory in php folder which contains php.exe and phpapache5.dll
4) copy all dll files to ur [...]

variable variables interesting ??

April 23, 2008

$foo = “Variable!\n”;
$bar = “foo”;
$wom = “bar”;
$bat = “wom”;
print $foo;
print $$bar;
print $$$wom;
print $$$$bat;
Here if you will print the output you will get
Variable! Variable! Variable! Variable!

what is the difference between “23″ and “\x23″

April 22, 2008

023 is octal number where as x23 is a hex number.

how to get number of arguments in functions

April 21, 2008

well we can get it by using “func_num_args“
most important thing is that we have to call this function inside the called function
like
function example(1,2,3)
{
$num=func_num_args();
return $num;
}

how can you call the constructor for parent class

April 21, 2008

parrent :: constructor($value)
example is :
class A {
function example() {
echo “I am A::example() and provide basic functionality.\n”;
}
}
class B extends A {
function example() {
echo “I am B::example() and provide additional functionality.\n”;
[...]

TCP port number

April 10, 2008

ports numbers are between 1 to 65536. We are mostly using upto 1024
20 and 21 for FTP
22 for SSH remote login protocol
23 for telnet
25 for SMTP (simple mail transfer protocol)
37 for time
53 for DNS (domain name server)
70 for GOPHER
80 for HTTP
110 for POP3
118 for SQL services
190 for Gate access control protocol (GACP)
194 for internet [...]