msgfmt_set_pattern(3) php man page | unix.com

Man Page: msgfmt_set_pattern

Operating Environment: php

Section: 3

MSGFMT_SET_PATTERN(3)							 1						     MSGFMT_SET_PATTERN(3)

MessageFormatter::setPattern - Set the pattern used by the formatter

	Object oriented style

SYNOPSIS
public bool MessageFormatter::setPattern (string $pattern)
DESCRIPTION
Procedural style bool msgfmt_set_pattern (MessageFormatter $fmt, string $pattern) Set the pattern used by the formatter
PARAMETERS
o $fmt - The message formatter o $pattern - The pattern string to use in this message formatter. The pattern uses an 'apostrophe-friendly' syntax; it is run through umsg_autoQuoteApostrophe before being interpreted.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1 msgfmt_set_pattern(3) example <?php $fmt = msgfmt_create( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatting result: " . msgfmt_format( $fmt, array(123, 456) ) . " "; msgfmt_set_pattern( $fmt, "{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatted number: " . msgfmt_format( $fmt, array(123, 456) ) . " "; ?> Example #2 OO example <?php $fmt = new MessageFormatter( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . $fmt->getPattern() . "' "; echo "Formatting result: " . $fmt->format(array(123, 456)) . " "; $fmt->setPattern("{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . $fmt->getPattern() . "' "; echo "Formatted number: " . $fmt->format(array(123, 456)) . " "; ?> The above example will output: Default pattern: '{0,number} monkeys on {1,number} trees' Formatting result: 123 monkeys on 456 trees New pattern: '{0,number} trees hosting {1,number} monkeys' Formatted number: 123 trees hosting 456 monkeys
SEE ALSO
msgfmt_create(3), msgfmt_get_pattern(3). PHP Documentation Group MSGFMT_SET_PATTERN(3)
Related Man Pages
datefmt_set_pattern(3) - php
msgfmt_format(3) - php
msgfmt_get_pattern(3) - php
msgfmt_parse_message(3) - php
msgfmt_set_pattern(3) - php
Similar Topics in the Unix Linux Community
floating point addition
How to write data in column
Combining chunks of data
Merge two columns from two files into one if another column matches
Compare IP addresses and increment