Basic question: function

<?php
function h()
{
echo 'hello';
}
?>
BIG
<? h(); ?>


Result with PHP4.3.10/Apache1.3.33 => BIGBIGhello
Result with PHP5.2.6/Apache2.2.3 => BIG

with PHP 5.2.6
hello is not displayed
why?
how can I fix this?

Thank you
Personne [ Di, 26 Juni 2007 20:08 ] [ ID #1748851 ]

Re: Basic question: function

Personne wrote:
> <?php
> function h()
> {
> echo 'hello';
> }
> ?>
> BIG
> <? h(); ?>
>
>
> Result with PHP4.3.10/Apache1.3.33 => BIGBIGhello
> Result with PHP5.2.6/Apache2.2.3 => BIG
>
> with PHP 5.2.6
> hello is not displayed
> why?
> how can I fix this?

There are two ways, configure php5 to use the short tags <?/?> or modify the
short tag to be a real tag <?php/?>.

I do suggest the later one, as you can get troubles when you need to use <?/?>
for something else like a xml header tag.

--

//Aho
Shion [ Di, 26 Juni 2007 20:12 ] [ ID #1748852 ]

Re: Basic question: function

Probably a little late, but try putting <?php h(); ?> instead of <? h(); ?>.

Martin

"Personne" <cpdivers [at] gmail.com> wrote in message
news:1182881288.107073.183430 [at] q75g2000hsh.googlegroups.com.. .
> <?php
> function h()
> {
> echo 'hello';
> }
> ?>
> BIG
> <? h(); ?>
>
>
> Result with PHP4.3.10/Apache1.3.33 => BIGBIGhello
> Result with PHP5.2.6/Apache2.2.3 => BIG
>
> with PHP 5.2.6
> hello is not displayed
> why?
> how can I fix this?
>
> Thank you
>
Martin Adams [ So, 22 Juli 2007 11:57 ] [ ID #1775491 ]
PHP » alt.php » Basic question: function

Vorheriges Thema: My free PHP video tutorials
Nächstes Thema: PHP table cell onclick