xref: /PHP-8.1/ext/intl/tests/msgfmt_clone.phpt (revision 74859783)
1--TEST--
2Cloning msgfmt
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7include_once( 'ut_common.inc' );
8$GLOBALS['oo-mode'] = true;
9$res_str = '';
10/*
11 * Clone
12 */
13$fmt = ut_msgfmt_create( "en_US", "{0,number} monkeys on {1,number} trees" );
14
15// Get default patten.
16$res_str .= "Formatting result: " . ut_msgfmt_format( $fmt, array(123, 456) ) . "\n";
17$fmt_clone = clone $fmt;
18// Set a new pattern.
19$pattern = "{0,number} trees hosting {1,number} monkeys";
20$res = ut_msgfmt_set_pattern( $fmt, $pattern );
21$res_str .= "Formatting result: " . ut_msgfmt_format( $fmt, array(123, 456) ) . "\n";
22$res_str .= "Formatting clone result: " . ut_msgfmt_format( $fmt_clone, array(123, 456) ) . "\n";
23
24echo $res_str;
25
26?>
27--EXPECT--
28Formatting result: 123 monkeys on 456 trees
29Formatting result: 123 trees hosting 456 monkeys
30Formatting clone result: 123 monkeys on 456 trees
31