JText/printf

From Joomla! Documentation

Jump to: navigation, search

printf() method is comparable to the PHP function printf(). This method returns the length of the resultant string and outputs the translation.

Contents

Description

Passes a string thru an printf.

Syntax

static JText::printf($string)
Parameter Name Default Value Description
$string The format string.

Defined in

libraries/joomla/methods.php

Importing

jimport( 'joomla.methods' );

Source Body

        public static function printf($string)
        {
                $lang = &JFactory::getLanguage();
                $args = func_get_args();
                if (count($args) > 0)
                {
                        $args[0] = $lang->_($args[0]);
                        return call_user_func_array('printf', $args);
                }
                return '';
        }

Examples

$len = JText::printf('SAVED_ITEMS', 3);
Personal tools