PHP/Language Basics/Php Functions
Содержание
Functions to Check Data Type
Name Description
is_null() Returns true if the value is null (no type)
is_string() Returns true if the value is a string
is_int() Returns true if the value is an integer
is_float() Returns true if the value is a floating-point value
is_array() Returns true if the value is an array
is_object() Returns true if the value is an object
is_a() Deprecated; checks if an object is a specified class
instanceof() Checks if an object is an instance of a class
Functions to Convert Data Types
Function Description
doubleval() Accepts a value and returns double equivalent
intval() Accepts a value and returns integer equivalent
strval() Accepts a value and returns string equivalent
Functions to Test Data Types
Function Description
is_array() Returns true if the argument is an array
is_bool() Returns true if the argument is boolean
is_double() Returns true if the argument is a double
is_int() Returns true if the argument is an integer
is_object() Returns true if the argument is an object
is_string() Returns true if the argument is a string
is_null() Returns true if the argument is null
is_resource() Returns true if the argument is a resource
GMP Functions
Name Description
gmp_abs Calculates absolute value
gmp_add Adds numbers
gmp_and Logical and
gmp_clrbit Clears bit
gmp_cmp Compares numbers
gmp_com Calculates one"s complement
gmp_div_q Divides numbers
gmp_div_qr Divides numbers and gets quotient and remainder
gmp_div_r Remainder of the division of numbers
gmp_div Alias of gmp_div_q()
gmp_divexact Exact division of numbers
gmp_fact Factorial
gmp_gcd Calculates GCD
gmp_gcdext Calculates GCD and multipliers
gmp_hamdist Hamming distance
gmp_init Creates GMP number
gmp_intval Converts GMP number to integer
gmp_invert Inverse by modulo
gmp_jacobi Jacobi symbol
gmp_legendre Legendre symbol
gmp_mod Modulo operation
gmp_mul Multiplies numbers
gmp_neg Negates number
gmp_or Logical or
gmp_perfect_square Perfect square check
gmp_popcount Population count
gmp_pow Raises number into power
gmp_powm Raises number into power with modulo
gmp_prob_prime Checks if number is "probably prime"
gmp_random Random number
gmp_scan0 Scans for 0
gmp_scan1 Scans for 1
gmp_setbit Sets bit
gmp_sign Sign of number
gmp_sqrt Calculates square root
gmp_sqrtrem Square root with remainder
gmp_strval Converts GMP number to string
gmp_sub Subtracts numbers
gmp_xor Logical xor
Using the @ operator to suppress a warning about the undefined variables
<?php
$scores = array(88, 75, 91, 84);
list($maths, , $history) = $scores;
@printf("<p>Maths: %d; English: %d; History: %d; Biology: %d.</p>\n",
$maths, $english, $history, $biology);
?>