PHP
Transliteration PHP Extension
This extension allows you to transliterate text in non-latin characters (such as Chinese, Cyrillic, Greek etc) to latin characters. Besides the transliteration the extension also contains filters to upper- and lowercase latin, cyrillic and greek, and perform special forms of transliteration such as converting ligatures such as the Norwegian "æ" to "ae" and normalizing punctuation and spacing.
At the moment the supported transliteration filters include: Cyrillic-to-Latin transliteration, Greek-to-Latin transliteration, Han-to-Latin transliteration, Hebrew-to-Latin transliteration; case converting filters for Greek, Latin and Cyrillic and filters to remove diacriticals from text, normalizing ligatures and normalizing punctuation.
Examples
Example text:
ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğ 大平矿难死者增至66人 郑煤所属煤矿全停产
Script:
<?php $string = file_get_contents( 'test-text.utf8' ); $res = transliterate( $string, array( 'han_transliterate', 'diacritical_remove' ), 'utf-8', 'utf-8' ); echo $res; ?>
Output text:
AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGg dapingkuangnansǐzhezengzhi66ren zhengmeisuǒshǔmeikuangquantingchǎn
Filters
Besides the transliterate() function, there is another function that returns all the available filters. This function is transliterate_filters_get(). It returns an array containing all filter names.
Download Source
Simply run the pear installer tool to install the extension:
pear install http://pecl.php.net/get/translit
Vulcan Logic Dumper
The Vulcan Logic Dumper hooks into the Zend Engine and dumps all the opcodes (execution units) of a script. It can be used to see what is going on in the Zend Engine.
If you have problems compiling or using this extension, please do not send me email about it. If you can't make it work then this tool is not for you. If you are certain there is a bug, then provide a patch.
New Features in 0.9
PHP 5.2 / PHP 5.3 support.
Some extra verbosity options (check the source to figure out which).
New Features in 0.8
PHP 5.0 / PHP 5.1 support.
vld will only show opcodes if the setting vld.active is set to 1.
New Features in 0.6
Class methods info is only dumped if they contain some user defined functions.
Clean up the framework for better opcode display.
Print extended value for function calls (# of args in that case).
Op code elements are only printed when they are actually used.
Download and Installation Instructions
The extension is not totally finished yet, but it works fine for me. If you have questions, feel free to send me an e-mail at derick at php dot net.
You can get the source from SVN:
svn co svn://svn.xdebug.org/svn/php/vld/trunk vld
It's not hard to use this extension, but it might not work with all PHP versions. Here are the instructions to get it to work:
Unpack the tarball: tar -xzf vld-0.9.1.tgz.
cd into the newly created directory.
Create the configure script: phpize
Now run "./configure" followed by "make install".
That's it, if you now run PHP from the command line and add the -dvld.active=1 parameter VLD will spit out the opcodes:
php -dvld.active=1 program.php
There is also a setting vld.execute to disable execution of code, and vld.verbosity to control how much output VLD generates.
Xdebug Extension for PHP
The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following:
stack traces and function traces in error messages with:
full parameter display for user defined functions
function name, file name and line indications
support for member functions
memory allocation
protection for infinite recursions
Xdebug also provides:
profiling information for PHP scripts
capabilities to debug your scripts interactively with a debug client
Information about Xdebug in more detail is available at http://xdebug.org.