Reza Amya
Reza Amya

Reputation: 1724

what is the <% in the php files and how it should compile?

I have new sample.php file that is it active on a cpanel (Apache server) and it is work correctly on that cpanel, I don't know how it is working! because it is PHP file but it is using <% instead of <?PHP in it's php syntax and %> instead of ?> and <%= instead of <?PHP echo.


can you tell me what is the <% and how I can enable it in my cpanel?

Upvotes: 0

Views: 164

Answers (1)

Jacob S
Jacob S

Reputation: 1703

<% are called "asp-style tags".

If you have access to the php.ini, set asp_tags = Off or asp_tags = 0 to asp_tags = On or asp_tags = 1 respectively.

To temporarily enable asp-tags for a script, you can add <?php ini_set('asp_tags',1) ?> to the beginning of the file, but this is less than ideal.

The alternative would be to replace each <% with <?php and each %> with ?>. If you are using short_tags, you can replace <%, %>, and <%= with <?, ?>, and <?=, respectively.

Upvotes: 3

Related Questions