Hello, does all php versions accept the <?= ?> or no ??

Don't you think for designers <?= ?> is easier than <? echo ?>

Thank you

Dani AI

Generated

Short answer: the short-echo form is just a shorthand for printing a value, but whether it works depends on PHP version and server configuration. was right to flag portability, and ’s note about the server/version matters — both are relevant.

To verify your environment:

  • On the server CLI run:
    php -v
  • Put a tiny PHP file on the webroot that calls phpinfo() to inspect the loaded PHP version, the path to the active php.ini, and the value of the short_open_tag directive.

Important compatibility note: since PHP 5.4 the short-echo construct is always available regardless of the short_open_tag setting. On older PHP releases the short forms could be disabled by configuration, so tutorials from older dates might rely on hosts that enabled short tags.

If you must support unknown/old hosts, use the full-form echo in templates for maximum portability, or confirm and set the host’s configuration:

  • Edit php.ini (or a per-site php.ini) and set short_open_tag = On and restart the web server, or ask the host to enable it.
  • On some Apache setups you can enable it with a .htaccess php_flag, but that only works for mod_php; many modern setups (PHP-FPM, CGI) won’t accept that and require php.ini or host support.

Quick troubleshooting: seeing the short syntax rendered literally in the browser usually means PHP isn’t parsing the file (wrong extension or handler) or short tags are disabled. Check error logs, phpinfo, and the actual PHP binary version used by the web server (CLI and web SAPI can differ).

Recommended Answers

All 5 Replies

Member Avatar for Member #120589

Not all servers are configured to accept short tags. It may be easier, but more dangerous if you move your site to a different server / host.

Just use full tags - can't be that difficult surely?

I can't see why you'd need to use too many php tags anyway. If you separate your html and php properly or even use a templating engine.

ardav Thank you ... I am using framework and I can see in approx all video tutorials they are using <?= ?> instead of <?php echo ?>, it makes me curious to know more about it!!

Member Avatar for Member #120589

OK solved?

in version of server

yup Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.