Differences / analysis errors in PHP7.0.3 <? Php $ foo

I have the following code:

<?php$selectbox->display();?> 

which is not too pleasant, but works well on Ubuntu PHP 7.0.3-1+deb.sury.org~vivid+1 (mod_php)

On my uberspace with PHP 7.0.3 (FCGI) I get an error

 mod_fcgid: stderr: PHP Parse error: syntax error, unexpected '$selectbox' (T_VARIABLE) 

Why could this be?

Just asking out of curiosity - the correction itself, of course, is simple.

+5
source share
1 answer

The problem is not related to a different system. It depends on the php configuration in the php.ini file. In this case, it depends on the short_open tag.

Maybe short_open set to On in php.ini in uberspace, so after <? it will be considered the start of php and will take the value of php (after <? ) as a constant. Therefore, it will cause an error for $selectbox . You can try the following debugging to confirm that its current problem is short_open .

1) Set short_open to Off . In php.ini change the following line

 short_open_tag = On 

to

 short_open_tag = Off 

2) Or remove php after <? If you do not want to change php configuration

 <?$selectbox->display();?> 
+3
source

Source: https://habr.com/ru/post/1244456/


All Articles