$name = 'John'; $message = 'Hello, {name}!'; $processed_message = CHtml::resolveValue($message, array('name' => $name)); echo $processed_message; // outputs "Hello, John!"
$fruit = array('apple', 'banana', 'orange'); $text = 'I like {0}, {1}, and {2}'; $processed_text = CHtml::resolveValue($text, $fruit); echo $processed_text; // outputs "I like apple, banana, and orange"Here, we pass an array of values to the resolveValue() method, which replaces the numbered placeholders in the `$text` string with the corresponding values from the `$fruit` array. This method is part of the CHtml class in the Yii PHP framework.