Variable Operations

Variable Operations

  • Operating on an initialized variable is 376% faster than operating on an unitialized variable.
  • Constants are 146% slower than variables
  • Local variables are 9.9% faster than global variables

String Functions

  • ‘String’ is 0.26% faster than “String”
  • “String” is 4% faster than HEREDOC syntax
  • “String\n” is 108% faster than ‘String’.”\n”
  • ‘String’.$var is 28% faster than “String$var”
  • ‘string ‘.$var.’ string’ is 55% faster than sprintf(‘string %s string’, $var)
  • “\n” is 70% faster than chr(10)
  • strnatcmp() is 4.95% faster than strcmp()
  • strcasecmp() is 45% faster than preg_match()
  • strcasecmp() is 6.6% faster than strtoupper($string) == “STRING”
  • strcasecmp() is 13% faster than strnatcasecmp()
  • strtr($string, $string1, $string2) is 10% faster than str_replace()
  • str_replace() is 161% faster than strtr($string, $array)
  • stristr() is 10% faster than stripos()
  • strpos() is 9.7% faster than strstr()
  • isset($str{5}) is 176% faster than strlen($str) > 5
  • str_replace($str, $str, $str) twice is 17% faster than str_replace(array, array, string)
  • list() = explode() is 13% faster than substr($str, strpos($str))

Numeric Functions

  • ++$int is 10% faster than $int++
  • (float) is 48% faster than settype($var, ‘float’)

Array Functions

  • list() = $array; is 3.4% faster than assigning each variable
  • in_array() is 6% faster than array_search
  • isset($array[$key]) is 230% faster than array_key_exists()
  • !empty($array) is 66% faster than count($array)

Output Functions

  • echo is 5% faster than print()
  • echo ‘ ‘.’ ‘ is 0.44% faster than echo ‘ ‘,’ ‘
Advertisements
Categories: php programming tips

Job for frshers as a KM Administrator / Consultant

December 2, 2009 Leave a comment

Apitco Limited Recruits KM Administrator / Consultant

Experience : 0 – 2 Years
Location : Hyderabad / Secunderabad
Education : UG – B.Tech/B.E. – Computers, Electrical, PG – Post Graduation Not Required

Job Description :
Promotes facilitates and supports the knowledge management system within the organization- with optimized outputs and process management.

Desired Candidate Profile :
BE (ECE) with knowledge on MS SQL server 2000 & 2005 , Clustered SQL servers , replication, log shipping, database mirroring, knowledge on SEC technology platform ,etc

Company Profile :
APITCO is a leading Technical Consultancy Organization (TCO) promoted jointly by all India Financial Institutions (IDBI, IFCI and ICICI), leading nationalized banks and State level corporations.

Company Name : APITCO Limited
Website : http://www.apitco.org
Executive Name : Mr. P Janaki Ram
Telephone : 040-23237333

PHP Tips # 5 – To Remember When Using A PHP Form Generator

December 2, 2009 Leave a comment

When you have an online business, using  this  PHP form Generator always a smart idea. A form generator can help you generator many different forms that you will need on your website. When using a generator, there are some important tips that you need to remember.

These tips can help you use the generator more effectively. Here are the most important tips to keep in mind.

1. Be careful when choosing a generator to use because you don’t have to pay for using one. There are many sites online that state that you do have to pay, but there are many free generators online that you can use for free.

This is not saying that you don’t want to pay for a generator if you find a good one that will benefit your business. It just means that you want to be careful and look at all of your options before choosing the best one to use for your particular business.

2. In order to use the generator effectively, you have to take time to learn how to use it. Read any instructions that come with it, try it out and just spend some time getting used to using it. This is the best way to learn how to use it effectively, which is important to the success of your business website.

3. Don’t overwrite your website. In other words, build a good website one page at a time and don’t just stuff a bunch of pages into it because you have the ability to add whatever pages you want to. You want to be sure that you are generating pages that will benefit your business, but will also benefit your customers.

Build a quality website using a form generator and don’t overdo the pages used or it will just look cluttered. This is very unappealing to online customers and will definitely end up hurting your business. It could also end up costing you money when your visitors go to your competition instead of your site.

Always do these things and you will not only be able to use it effectively, but will also end up with a great website that will attract and keep customers coming back. Find a good generator to start using today because this is definitely a tool that every business owner needs to be using.

PHP TIPS #4 – Array_diff_uassoc Function in PHP

December 1, 2009 Leave a comment

Function Description:

array_diff_uassoc() function which compares two or more arrays while checking for differences before comparing the keys with a user-defined location. It then returns an array withthe keys and values from the first array(to which all the values were comapred against) it the function allows it.

Syntax is as follows : array_diff_uassoc(array1,array2,array3….,function).

with a sample below of how it is used.

function userdefined($v1,$v2)
{
if ($v1 === $v2)
{
return 0;
}
if ($v1 > $v2)
{
return 1;
}
else
{
return -1;
}
}
$a1=array(0=>”Dog”,1=>”Cat”,2=>”Horse”)
$a2=array(3=>”Dog”,1=>”Cat”,5=>”Horse”)
print_r(array_diff_uassoc($a1,$a2,”userdefined”));
?>

which results in the following output : Array( [0] => Dog [2] => Horse). For an example of the same function with two or more assigned arrays to the function:

function userdefined($v1,$v2)
{
if ($v1 === $v2)
{
return 0;
}
if ($v1 > $v2)
{
return 1;
}
else
{
return -1;
}
}
$a1=array(0=>”Dog”,1=>”Cat”,2=>”Horse”)
$a2=array(3=>”Dog”,1=>”Cat”,5=>”Horse”)
$a3=array(6=>”Onyx”,0=>”Dog”,5=>”Horse”)
print_r(array_diff_uassoc($a1,$a2,$a3,”userdefined”));
?>

Which in turn, gives you : Array ([2] => Horse )

So we see the different array_diff function variants and the diffeerent ways they are used to compare the values of one or more arrays with one another.

PHP Fresher/Trainee in Chennai

December 1, 2009 Leave a comment

COMPANY: SPACE COMPUTER AND SYSTEMS LTD

JOB DESCRIPTION:

Candidates  have to undergo hands on training in web2.0 technologies which includes Javascript and Ajax, PHP, C# and ASP.Net, Java/J2EE, MySQL, XML, Web 2.0 framework, Mashups, Dojo widgets, Echo2, Ajax security framework and toolkit including Web 2.0 enterprise. Post training upon their evaluation candidates will be taken in for Live projects in Web based Applications.
POSITION REQUIREMENTS:
Any Eng gradutes with Computer science /IT background and candidates who are willing to shift their career to web technologies shallapply.
CONTACT: HR, training@spacecs.com
Job ID: 3926
Location: Chennai

PHP software Engineer

November 19, 2009 Leave a comment

Flipkart.com is a passionate and determined group of professionals that wish to create an excellent buying experience for you by leveraging the best of breed technology. We spend our days and weeks researching how we can make your search for books faster and easier. Nothing excites us more than satisfaction of our customers.

Responsibilities

  • Write maintainable, unit-tested code in Python, PHP and Java to solve business problems
  • Develop object-oriented models and design data structures for new software projects
  • Implement business logic and data models with suitable class design
  • Work with designers, business analysts, and product managers to estimate and plan projects in an Agile development framework
  • Work on a cross-functional team, collaborating with peers on all elements of the development process
  • Follow industry coding standards
  • Create appropriate technical documentation

Qualifications

  • Minimum 1 year experience, ideally in a relevant area
  • Strong problem solving skills,
  • Good understanding of data structures & algorithms and their space & time complexities
  • Excellent coding skills – should be able to convert design into code fluently
  • B Tech in Computer Science or equivalent from a reputed college

Address:
Flipkart.com, 1st Floor,
No. 447/C, 1st A Cross,
12th Main, 4th Block,
Opp. BSNL Telephone Exchange,
Koramangala,
Bangalore – 560034
Karnataka, India

Please send your updated resumes to careers@flipkart.com

PHP tips #3- .htaccess Password Protection in php

November 19, 2009 Leave a comment

Even without using mySQl, users can still password protect their files through .htaccess password protection.

The code can be divided into 3 if-else statements:

1. If the user has not been validated, use the PHP header and request for a username and password.

2. Else, if the user’s name is “webworld” and the password is “webworld”, log in. Here, all the code for the user will be placed.

3. Else say the user/password failed.

////1st part
if (!isset($PHP_AUTH_USER))
{
header(“WWW-Authenticate: Basic realm=\”webworld Password.\””);
Header(“HTTP/1.0 401 Unauthorized”);
exit;
}

////2nd part
else if(($PHP_AUTH_USER==”webworld”) && ($PHP_AUTH_PW==”webworld”))
{
echo “You are logged in…”;
////put the code for the whole user page in here
////you can also create a redirect to the user page if you want
}

////3rd part
else
{
echo “Failed entry”;
////fail try again
}
?>

Remember that the username and password will remain for the whole session as long as explorer windows is open.