The setlocale Function in PHP PRO

Calling this function we can apply a specific locale (combination of a language, a country and possible few more values) on our program. The first argument should be a constant that specifies on what do we want to apply the new locale (e.g. LC_NUMERIC will apply our locale on the decimal separator). The second argument is a string composed of two small letters that represent a specific language, two capital letters that represent a specific country and few more possible values.

<?php
setlocale(LC_NUMERIC,"he_IL");
$sum = 1249293.24;
printf("sum is %f",$sum);
?>

The following short video clip shows the execution of this code sample and explains it.

Share:

The Visitor Design Pattern

The Visitor Design Pattern

The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences