Calling Method Closes PHP. interpreted as '?>'

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
securinx
Forum Newbie
Posts: 2
Joined: Tue Aug 12, 2008 3:47 pm

Calling Method Closes PHP. interpreted as '?>'

Post by securinx »

Hi all,

I'm new here but have been coding for a while.. I've never run across this though, was hoping maybe somebody here had and could give me a tip. I am basically on a clients new box. php 5.2.4/apache 2.2. I am implementing classes and I can instantiate them fine, but when I go to call a method, Somehwere the '->' is interpreted as a ?> close tag so :

Code: Select all

 
$class = new class; // works fine
 
$class->retrieve(); // returns "retrieve();" (equivalent of $class?>retrieve();
 
I have checked httpd.conf and php.ini but cant find where this happens. asp tags are off. has anybody ran into this?

Beto
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Calling Method Closes PHP. interpreted as '?>'

Post by ghurtado »

Your theory sounds fishy to me. If that were the case, you would get a PHP parsing error due to the missing semicolon. I think it is a lot more likely that PHP parsing is not enabled in apache, and your browser shows you the rest of what it considers to be "outside" the php "Tag", after it encounters ">". Take a look at the source of the page and post it here.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: Calling Method Closes PHP. interpreted as '?>'

Post by jmut »

I guess you put some valid identifier for class name but 'class' is reserved word and new class is parse error.
@ghurtado Last statment wouldn't require semicolon;

Code: Select all

 
//this is ok;
<?php
$var = 1;
echo $var
?>
 
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Calling Method Closes PHP. interpreted as '?>'

Post by ghurtado »

Thanks jmut, I never knew that.

I still believe PHP is not getting parsed, since all that is output is "retrieve();"
securinx
Forum Newbie
Posts: 2
Joined: Tue Aug 12, 2008 3:47 pm

Re: Calling Method Closes PHP. interpreted as '?>'

Post by securinx »

Thanks for the tips guys. hurtado you;re right, it wasn;t getting parsed. the box wasn't set up to recognize <?, only <?php .

Beto
Post Reply