Comunitatea PHP Romania
 

 
string_format

string_format

This is a way to format strings, such as decimal numbers and such. Use the syntax for sprintf() for the formatting.

Parameter PositionTypeRequiredDefaultDescription
1stringYesn/aThis is what format to use. (sprintf)

Example 5-18. string_format

<?php

$smarty
->assign('number'23.5787446);

?>

Where template is:

{$number}
{$number|string_format:"%.2f"}
{$number|string_format:"%d"}

Will output:

23.5787446
23.58
24

See also date_format.

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
acasa , in pat
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
Mascka Mascka
Braila
raul_ raul_
whooper whooper
Toronto ON
mihaitha mihaitha
Sibiu
gabysolomon gabysolomon
Bacau
oriceon oriceon
Constanta
garlicinicolae garlicinicolae

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Loans | Loans | Personal Loans | Credit Cards | Just Holden Commodores
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis