Page 1 of 1

Can't escape PHP within a function to get plain HTML

Posted: Thu Aug 27, 2009 12:55 pm
by denisdee
Hi there,

Got a little issue with PHP 5.3.0
When I enter this code :

Code: Select all

<?php 
    function my_function() {
?>
My function was called
<?php
  }
?>
nothing happens. Don't get anything in my browser (tried in IE and Firefox). The text doesn't show and I don't get any error (although PHP is configured to display error).
Strangely enough, I ran some code that I got from a tutorial in my browser with the same type of functions and it worked just fine.
I'm a bit confused.

Re: Can't escape PHP within a function to get plain HTML

Posted: Thu Aug 27, 2009 12:57 pm
by jackpf
Works for me.

Re: Can't escape PHP within a function to get plain HTML

Posted: Thu Aug 27, 2009 1:07 pm
by requinix
You do realize you have to call the function for it to do anything, right?

Code: Select all

<?php
    function my_function() {
?>
My function was called
<?php
  }
 
my_function();
?>

Re: Can't escape PHP within a function to get plain HTML

Posted: Tue Sep 01, 2009 1:32 pm
by denisdee
I do realize it now. :banghead: I was so sure that there was a problem (had some issues before that and had to reinstall php) that I thought that there had to be something wrong when there hadn't.

Thanks anyway.