Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Simon Holywell:
PHP date localisation with setlocale
Jul 21, 2015 @ 17:57:07

Simon Holywell as written up a tutorial for his site showing you how to use setlocale to do PHP date localization.

Localising sites can be a chore, but PHP has the venerable setlocale() to use system locales. These are like templates or profiles that describe how various types of data should be displayed. Should a price have a comma or point to indicate the decimals? When printing a date should PHP output Monday or Montag?

All of these considerations are locale specific and they map to a geographical area. Various cultures have their own standards for displaying this kind of information not to mention different languages to accommodate.

He shows how to find the locales your system supports and how to install them if the one(s) you need are missing. With it correctly installed, the system knows how to use it but PHP needs a little extra help. With a call to the setlocale method and the use of a special date string modifier (in this case "%B" for the month name) PHP knows to use the locale-aware version of the data...but only with strftime not the normal PHP date handling.

tagged: simonholywell setlocale locale localization strftime

Link: https://www.simonholywell.com/post/2015/07/php-date-setlocale-localisation/

SecurityReason:
Three Advisories for PHP 5.2.4 (dl, iconv_substr & setlocale)
Sep 13, 2007 @ 14:33:00

The SecurityReason website has three new advisories posted concerning the latest release in the PHP 5 series:

The dl() overflow is marked as a medium threat (largely because it allows for arbitrary code execution) but the other two are shown as low threat. A patch is also given for the dl() issue to help correct the problem.

tagged: php5 advisory dl iconv_substr setlocale medium low php5 advisory dl iconv_substr setlocale medium low

Link:

SecurityReason:
Three Advisories for PHP 5.2.4 (dl, iconv_substr & setlocale)
Sep 13, 2007 @ 14:33:00

The SecurityReason website has three new advisories posted concerning the latest release in the PHP 5 series:

The dl() overflow is marked as a medium threat (largely because it allows for arbitrary code execution) but the other two are shown as low threat. A patch is also given for the dl() issue to help correct the problem.

tagged: php5 advisory dl iconv_substr setlocale medium low php5 advisory dl iconv_substr setlocale medium low

Link:


Trending Topics: