Hi Guys, I know this is a stupid question. I often see T_ prefix used in php code , for example:
die(T_('message_die() was called multiple times.'));
$debug_text .= '<br /><br />'. T_('SQL Error') .' : '. $sql_error['code'] .' '. $sql_error['message'];
What exactly does the T_prefix do?.
Thx
T_ Prefix
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
In PHP's own error reporting you'll see it. I'm not sure who'd use it for an SQL error as that would not make much sense.
PHP will use T_... for syntax errors where the parser failed to tokenize code. T is for "token".
Source code is broken down into small chunks called tokens when PHP starts to parse it:
Take the code:
PHP turns it into something like:
1. <?php
2. class
3. Foo
4. {
5. }
Each of those tokens have a name like T_PHP_OPEN, T_CLASS, T_STRING etc
These are the names you see in errors
PHP will use T_... for syntax errors where the parser failed to tokenize code. T is for "token".
Source code is broken down into small chunks called tokens when PHP starts to parse it:
Take the code:
Code: Select all
<?php
class Foo
{
}1. <?php
2. class
3. Foo
4. {
5. }
Each of those tokens have a name like T_PHP_OPEN, T_CLASS, T_STRING etc
These are the names you see in errors
There's also a function called T_ in b2evolution, http://doc.b2evolution.net/v-0-9/evocor ... e.php.html
similar to http:/de2.php.net/_
similar to http:/de2.php.net/_