Software Technology Tips

Generally, a quote is used to create a string.

A quote can be a single quote( ' ' ) or a double-quote ( " " ) but in PHP they should not be considered the same! The reason for this is that the double-quote is parsed by PHP while string created with single-quotes are not.

For example:
//In both case output is 'Mindfire Solutions'
$string = 'Solutions';
echo 'Mindfire ' . $string;
echo "Mindfire $string";

Parsing variables within strings uses more memory than string concatenation.

In the above example the output is the same the last line tends to take more memory as it parses the string.
When writing a PHP script in which memory usage is a concern, consider using the single quote and the concatenation operator (.) rather than variable parsing.


Related Tags:

PHP

Author: Asish Tripathy

Related Pages

  • PHP Development Offshore
  • PHP Programming Projects

PHP

Let us Connect!

iso 9001 QA25 Red Herring STPI D&B Fastest Growing SME 2013 Award zinnov Nasscom

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login