tailieunhanh - PHP Developer's Dictionary- P38

PHP Developer's Dictionary- P38:PHP is an open source, server-side, HTML-embedded scripting language used to create dynamically generated Web pages. With an easy-to-use syntax and a large, extensible library of modules, PHP brings together the best of Perl, C++, and other languages. | PHP Developer s Dictionary The trim function removes whitespace from str and returns the resulting string. Whitespace includes n r t v 0 and a plain space. ucfirst Syntax string ucfirst string str Description The ucfirst function capitalizes the first character of str if it is alphabetic. The alphabet is determined by the current locale setting. text hello world echo ucfirst text displays Hello world ucwords Syntax string ucwords string str Description The ucwords function which was added in PHP and PHP returns a string that is str with each word s first letter uppercased if it is alphabetic. text hello world echo ucwords text displays Hello World Variable The following functions deal primarily with getting and setting variable types. doubleval Syntax double doubleval mixed var IT-SC book 185 PHP Developer s Dictionary Description The doubleval function returns the double floating-point value of the var parameter. The var parameter must be a scalar type and not an object or array. empty Syntax int empty mixed var Description The empty function determines whether a variable is set. It returns false if var is set to a nonempty or nonzero value and true otherwise. gettype Syntax string gettype mixed var Description The gettype function returns the PHP-defined type of the parameter var . Possible PHP types include integer double string array object and unknown type. avar array 1 2 3 echo gettype avar displays array intval Syntax int intval mixed var int base Description IT-SC book 186 PHP Developer s Dictionary The intval function returns the integer value of the parameter var using the specified base for the conversion. base is an optional parameter with 10 as the default. The parameter var may be any scalar type. Note that you cannot use intvai on arrays or objects. echo intval 123 displays 123 echo intval 10 16 displays 16 is_array Syntax int is_array mixed var Description The is_ array function returns true if var is an array and returns false otherwise.