How do i convert php short tag to full one
Converting can be written using http://php.net/manual/en/function.token-get-all.php . Unlike find&replace, this does not affect XML declarations and so on.
Converting vs. enabling ST: It depends. Many programmers probably prefers <?php to <?, so when you convert, you code will be more "standard". However, the importancy https://meta.stackoverflow.com/of "standard"-way depends on the situation.
How do i convert php short tag to full one
Converting can be written using http://php.net/manual/en/function.token-get-all.php . Unlike find&replace, this does not affect XML declarations and so on.
Converting vs. enabling ST: It depends. Many programmers probably prefers <?php to <?, so when you convert, you code will be more "standard". However, the importancy https://meta.stackoverflow.com/of "standard"-way depends on the situation.
Finding all PHP short tags
The best way to find short-tags in vim is to find all occurrences of <?
not followed by a p
:
/<?[^p]
The reason your regex is failing in vim is because /?
finds literal question marks, while \?
is a quantifier; /<\?
in vim will attempt to find 0 or 1 less-than signs. This is backwards from what you might expect in most regular expression engines.
If you want to match short tags that are immediately followed by a new line, you cannot use [^p]
, which requires there to be something there to match which isn't a p
. In this case, you can match "not p or end-of-line" with
/<?\($\|[^p]\)
XAMPP does not recognize php, must replace all ? with ?php
You'll have to enable short_open_tag
in php.ini
However, for compatibility reasons with system where you haven't control over the php.ini, I would not use the short open tags.
Is there possible we use ? to ?php
You need to update php.ini
to accept the short notation of php's syntax. Look in php.ini
and look for short_open_tag
and set to On
. After you are done save it and restart Apache or Nginx (whichever you use).
PHP - What's wrong on this PHP syntax?
The code looks okay. However, your code is very difficult to read - I can almost understand dreamweaver for choking on it :)
Here is a simpler suggestion:
for($i=1; $i<=$npagine; $i++)
{
$class = ($i == $index ? "paginas" : "pagine");
echo "<a class='$class' href='index.php?$splitter_zone&index=$i'>$i</a>";
}
nginx + php-fpm not escaping with ? but IS escaping with ?php
Change your php configuration file to accept short tags. Reference
Related Topics
Whats the Easiest Way to Determine If a User Is Online? (Php/Mysql)
How to Return a Proper Success/Error Message for Jquery .Ajax() Using PHP
How to Remove the Leading Character from a String
Fastest Hash for Non-Cryptographic Uses
Check to See If a String Is Serialized
Accessing Laravel .Env Variables in Blade
Laravel Named Route for Resource Controller
MySQL and PHP - Insert Null Rather Than Empty String
Laravel Advanced Wheres How to Pass Variable into Function
Pull All Images from a Specified Directory and Then Display Them
Issues with PHP 5.3 and Sessions Folder
PHP - Extracting a Property from an Array of Objects
How to Convert Pascalcase to Snake_Case
How to Query Employee Details and Relate Their Performance Metrics
Forget Password Page, Creating a Generated Password to Email to the User