Apart from the annoyance of superfluous typing, there is a danger of getting lazy, seeing that <?php echo $foo;?> is remarkably shorter to type. In some situations, it won’t manifest itself as a problem either, since some content-types never contains HTML special characters (Numbers for example). This is particularly nasty, because errors in the view layer are notoriously hard to track down.
The Clash :
There is a problem though; Since this is such a good name for a function, chances are that someone else would use it for something different, or perhaps even for the same. I already know of at least one potential nameclash, since I got the idea from CakePHP.
The usual way of dealing with this, would be with namespaces, but — alas — PHP doesn’t have namespaces, and the common solution of pseudo namespaces(Eg. prefixing names) doesn’t work here, since it would defy the purpose of the function in the first place.
PHP isn’t exclusively for Web pages. You can use it like Perl for cron jobs and other tasks.
If PHP is your scripting language of choice when it comes to developing dynamic Web sites, you probably have grown to love its immediacy and power. An estimated ten million Web sites use at least some PHP scripting to generate their pages.
Although most people use PHP primarily as a Web development scripting system, it possesses all the characteristics of a proper general-purpose language that can be useful in a variety of other environments. In this article, I illustrate how it’s possible to use the command-line version of PHP to perform complex shell operations, such as manipulating data files, reading and parsing remote XML documents and scheduling important tasks through cron.
The contents of this article are based on the latest version of PHP at the time of this writing, 4.3.0, which was released at the end of 2002. However, you should be able to use older versions of PHP 4 without many problems. I explain the differences you may encounter as necessary.
With the release of PHP 4.3, a new version of the interpreter called command-line interface (or PHP-CLI) is available. PHP-CLI is not a shell as the name implies but, rather, a version of PHP designed to run from the shell. As far as software development is concerned, only a few differences exist between PHP-CLI and its CGI or server API (SAPI) counterparts. For one thing, traditional Apache server variables are not available, as Apache isn’t even in the picture, and the HTTP headers are not output when a script is executed. Also, the engine does not use output buffering, because it would be of no benefit in a non-Web environment.
To change the memory limit for one specific script by including a line such as this at the top of the script:
ini_set(“memory_limit”,”12M”);
The 12M sets the limit to 12 megabytes (12582912 bytes). If this doesn’t work, keep increasing the memory limit until your script fits or your server squeals for mercy.
<?php${'New variable text'} = 'This is a new variable text.'; echo ${'New variable text'}; // This is a new variable text. ?>
Php Hace Script
function hace($timestamp) { $diferencia = time() - $timestamp;  if($diferencia > 0)  { $periodo = array("segundo", "minuto", "hora", "dia", "semana", "mes" , "año", "decada"); $longitud = array( "60" , "60" , "24" , "7" , "4.35", "12" , "10" ); for($j = 0; $diferencia >= $longitud[$j]; $j++)  $diferencia /= $longitud[$j]; $diferencia = round($diferencia); if($diferencia != 1)  {  if($periodo[$j] == "mes")  $periodo[$j].= "es";  else  $periodo[$j].= "s";  } return "Hace <b>".$diferencia."</b> ".$periodo[$j];  } }
PHP is a powerful server-side scripting language for creating dynamic and interactive websites. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP. PHP is perfectly suited for Web development and can be embedded directly into the HTML code.
The PHP syntax is very similar to Perl and C. PHP is often used together with Apache (web server) on various operating systems. It also supports ISAPI and can be used with Microsoft’s IIS on Windows.