how to install composer on synology

By default, phar extension is not enabled, installation will be failed:

enable phar extension:

now get composer.phar

if you encounter this kind of error:

open DSM,  In the control-panel under Web-Services in the php-settings enable Customize PHP… Continue Reading


How to remove  from the beginning of a file in PHP

The best way to remove the special character of the beginning of a file in UTF-8 with DOM is to interpret it correctly by PHP:


Php header code

PHP header codes, for reference only:


get millisecond & unique timestampe in php

To get millisecond:

To get unique timestampe:


preg_replace_callback in class

variable scope in PHP is painful. not like java or javascript, you can’t get preg_replace_callback works like this:

what you have to do is like this: