views:

144

answers:

3

I have a php function that I wish to reduce even further.

<?='Testing'?>

Is there a way to reduce this any further?

+15  A: 

write Testing without the php tags. php will only interpret code between php tags, everything else will be outputted without any further processing.

knittl
+1 PHP is text first. Anything not surrounded by <?php and ?> is considered standard text.
Will Bickford
+3  A: 

Use a shorter word? ;)

Or put it outside the PHP tags (effectively starting and stopping the PHP goodiness).

?>Testing<?

Incidentally - I'm not overly sure what you want to achieve by "shortening". Do you want to make it faster, use less characters? From that example there - I'm not sure you're going to gain a whole lot from any of these examples.

Amadiere
A: 

You can assign the value you'd like printed to a short variable name before the output of the script:

<?php
$a = 'Testing';
?>

Then echo out that variable in the output:

<?=$a?>

Can't get any shorter than that.

Andre