Tag Archives: Functions

Error functions

Directory functions

  • chdir – It can be used to change directory
  • chroot – It can be used to change the root directory
  • closedir – It closes directory handle
  • dir – It return an instance of the Directory class
  • getcwd – It returns the current working directory
  • opendir – It opens directory handle
  • readdir – It reads entry from directory handle
  • rewinddir – It rewinds directory handle
  • scandir – It lists files and directories of a given path.

Calendar functions

  • cal_days_in_month – It returns the number of days in a month for a given year and calendar
  • cal_from_jd – It converts from Julian Day Count to a supported calendar
  • cal_info – It returns information about a particular calendar
  • cal_to_jd – It converts from a supported calendar to Julian Day Count.
  • easter_date – It returns the unix timestamp of easter date for a given year
  • easter_days – It returns the no of days between March 21 and Easter day of a given year.
  • FrenchToJD – It converts a date from the French Republican Calendar to a Julian Day Count
  • GregorianToJD – It converts a Gregorian date to Julian Day Count
  • JDDayOfWeek – It returns the day of the week
  • JDMonthName – It returns a month name
  • JDToFrench – It converts a Julian Day Count to the French Republican Calendar
  • JDToGregorian – It converts Julian Day Count to Gregorian date
  • jdtojewish – It converts a Julian day count to a Jewish calendar date
  • JDToJulian – It converts a Julian Day Count to a Julian Calendar Date
  • jdtounix – It convert Julian Day to Unix timestamp
  • JewishToJD – It converts a date in the Jewish Calendar to Julian Day Count
  • JulianToJD – It converts a Julian Calendar date to Julian Day Count
  • unixtojd – It convert Unix timestamp to Julian Day

Array functions

  • array_change_key_case – It converts the keys of an array into uppercase
  • array_chunk – It splits an array into chunks
  • array_combine – It creates an array by using one array for keys and another for its values
  • array_count_values – It counts all the values of an array
  • array_diff_assoc – It computes the difference of arrays with additional index check
  • array_diff_key – It computes the difference of arrays using keys for comparison
  • array_diff_uassoc – It computes the difference of arrays with additional index
  • array_diff_ukey – It computes the difference of arrays using a callback function on the keys for comparison
  • array_diff – It finds the difference of arrays
  • array_fill_keys – It fills an array with values, specifying keys
  • array_fill – It fills an array with the given values
  • array_filter – It filters elements of an array using a callback function
  • array_flip – It exchanges all keys with their associated values in an array
  • array_intersect_assoc – It finds the intersection of arrays with additional index check
  • array_intersect_key – It finds the intersection of arrays using keys for comparison
  • array_intersect_uassoc – It finds the intersection of arrays with additional index check, compares indexes by a callback function
  • array_intersect_ukey – It finds the intersection of arrays using a callback function on the keys for comparison
  • array_intersect – It finds the intersection of arrays
  • array_key_exists – It checks if the given key or index exists in the array
  • array_keys – It returns all the keys or a subset of the keys of an array
  • array_map – It applies the callback to the elements of the given arrays
  • array_merge_recursive – It merges two or more arrays recursively
  • array_merge – It merge arrays
  • array_multisort – It sorts multiple or multi-dimensional arrays
  • array_pad – It pads array to the specified length with a value
  • array_pop – It pops the last element of an array
  • array_product – It finds the product of values in an array
  • array_push It pushes one or more elements onto the end of array
  • array_rand – It fetches one or more random entries out of an array
  • array_reduce – It reduce the array to a single value using a callback function
  • array_replace_recursive – It replaces elements from passed arrays into the first array recursively
  • array_replace – It replaces elements from passed arrays into the first array
  • array_reverse – It returns an array with elements in reverse order
  • array_search – It searches the array for a given value
  • array_shift – It shift an element off the beginning of array
  • array_slice – It extracts a slice of the array
  • array_splice – It removes a portion of the array and replace it with something else
  • array_sum – It finds the sum of values in an array
  • array_udiff_assoc – It finds the difference of arrays with additional index check
  • array_udiff_uassoc – It finds the difference of arrays with additional index check
  • array_udiff – It finds the difference of arrays by using a callback function for data comparison
  • array_uintersect_assoc – It finds the intersection of arrays with additional index check,
  • array_uintersect_uassoc – It finds the intersection of arrays with additional index check, compares data and indexes by a callback functions
  • array_uintersect – It finds the intersection of arrays, compares data by a callback function
  • array_unique – It removes duplicate values from an array
  • array_unshift – It prepend one or more elements to the beginning of an array
  • array_values – It return all the values of an array
  • array_walk_recursive – It applay a user function recursively to every member of an array
  • array_walk – It apply a user function to every member of an array
  • array – It can be used to create an array
  • arsort – It sort an array in reverse order and maintain index association
  • asort – It sort an array and maintain index association
  • compact – it create array containing variables and their values
  • count – It Count all elements in an array
  • current – It returns the current element in an array
  • each – It return the current key and value pair from an array
  • end – It sets the internal pointer of an array to its last element
  • extract – It import variables into the current symbol table from an array
  • in_array It checks if a value exists in an array
  • key – It fetches a key from an array
  • krsort – It sorts an array by key in reverse order
  • ksort – It sorts an array by key
  • list – It assigns variables as if they were an array
  • natcasesort – It sorts an array using a case insensitive “natural order” algorithm
  • natsort – It sorts an array using a “natural order” algorithm
  • next – It moves the internal array pointer of an array
  • pos – It is an alias of current()
  • prev – It rewinds the internal array pointer
  • range – It can be used to create an array containing a range of elements
  • reset – it  set the internal pointer of an array to its first element
  • rsort – It  sorts the array in reverse order
  • shuffle – It shuffles the array
  • sizeof – It an alias of count()
  • sort – It sorts the array
  • uasort – It sorts an array with a user-defined comparison function and maintain index association
  • uksort – It sorts an array by keys using a user-defined comparison function
  • usort – It sorts an array by keys using a user-defined comparison function

Math functions

  • abs – It returns absolute value
  • acos – It returns arccosine value
  • acosh – It returns Inverse hyperbolic cosine
  • asin – It returns arc sine
  • asinh – It returns Inverse hyperbolic sine
  • atan2 – It returns Arc tangent of two variables
  • atan – It returns Arc tangent
  • atanh – It  returns Inverse hyperbolic tangent
  • base_convert – It convert a number between arbitrary bases
  • bindec – It converts binary number to decimal number
  • ceil – It round the fractions up
  • cos – It returns cosine value .
  • cosh – It returns Hyperbolic cosine .
  • decbin – It converts a decimal to binary
  • dechex – It converts a decimal to hexadecimal
  • decoct – It converts a decimal to octal
  • deg2rad – It converts the number in degrees to the radian equivalent
  • exp – It calculates the exponent of e
  • expm1 – It calculates the value of Ex-1
  • floor – It round fractions down
  • fmod – It returns the remainder of the division.
  • getrandmax – It shows largest possible random value
  • hexdec – It converts Hexadecimal to decimal
  • hypot – It calculate the length of the hypotenuse
  • is_finite – It checks whether a value is a legal finite number
  • is_infinite – It checks whether a value is a legal infinite number
  • is_nan – It checks whether a value is not a number
  • lcg_value – It returns combined linear congruential generator
  • log10 – It returns Base-10 logarithm value
  • log1p – It returns log(1+x)
  • log – It returns natural logarithm
  • max – It returns maximum value
  • min – It returns lowest value
  • mt_getrandmax – It returns largest possible random value
  • mt_rand – It generates a better random value
  • mt_srand – It seed the better random number generator
  • octdec – It converts octal number to decimal
  • pi – It returns the value of pi
  • pow – It returns Exponential expression
  • rad2deg – It converts the radian number to the equivalent number in degrees
  • rand – It generates a random integer
  • round – It rounds a float
  • sin – it returns sine value
  • sinh – it returns hyperbolic sine
  • sqrt – It returns Square root
  • srand – It seed the random number generator
  • tan – It returns tangent value
  • tanh – It returns hyperbolic tangent

DateTimeZone::getTransitions

It returns all transitions for the timezone
Example

<?php
echo “<pre>”;
$tz = new DateTimeZone(“Europe/London”);
$tzTransitions = $tz ->getTransitions();
print_r(array_slice($tzTransitions, 0, 2));
?>

Output

Array
(
[0] => Array
(
[ts] => -2147483648
[time] => 1901-12-13T20:45:52+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)

[1] => Array
(
[ts] => -1691964000
[time] => 1916-05-21T02:00:00+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)

)