To administer your WestHost account, please enter your
Domain Name or Server Manager Username.


Contest Submissions Have Closed

Thank you for your interest in WestHost's PHP contest. As of March 16th, 2011, the contest is closed for new submissions. We would like to thank our sponsors, System 76, Zend, and php|architect and all who participated in the contest.

Congratulations to the following individuals for their winning functions:

  • getCenter

    By subrahmanyam, submitted on 03/15/2011

    This function returns center of any two unsigned integers. It works with any type of data types.

  • Image Compress & Resize

    By Arivazhagan, submitted on 03/14/2011

    Compress Upload Image Size and Re-Size Image

  • AmPM

    By Ali A, submitted on 03/13/2011

    Converts time in the format: HH:MM:SS and HH:MM into AM/PM format. E.g: 13:05:00 -> 1:05 PM 15:30 -> 3:30 PM If the time is in the format: HH:MM instead of HH:MM:SS, set the 2nd argument to false.

  • mysqlToHuman

    By Ali a, submitted on 03/13/2011

    This function takes a date in mysql date format, i.e 2011-06-30, and returns a more easily readable date, e.g 6th June, 2011.

  • time_ago

    By Bui Hoang Hai, submitted on 03/11/2011

    A small and function for display past time that user posted (like 1 hour ago...). We just don't care the exact time like: he posted 2 days 1 hour 3 minutes ago. The logic is, the futher an event, the less we care about the exact time.

  • tryRepeat Object Function.

    By John Anderson, submitted on 03/11/2011

    try Repeat allows you to continuously execute a function until it returns true. $wtry = new tryRepeat('$this->objct->connect();',300,$dbLayer); first argument = function or method call second argument = time between trys third = object for method call also optional

  • XML String to Array - Concise

    By James, submitted on 03/11/2011

    There is no quick and convenient way to convert XML into an assoc array (that I know of). This concise function does just that using json_decode & json_encode. Compatible only with PHP5 and up. Also, requires the JSON extension.

  • Array Return By Key

    By Brandon Kozak, submitted on 03/10/2011

    This function will return an array by any key held within the array. Very nice for sorting by returned columns from a database.

  • Array Dereference

    By Shaun, submitted on 03/10/2011

    Returns the value of an array by key when the array is returned via a function call. Ex: $x = dereference(func(),'someKey'); instead of $arr = func(); $x = $arr['someKey'];

  • Get Disk Memroy Space based on option

    By Tam, submitted on 03/09/2011

    Function is used to get memory limit of particular disk and will print memory space in according to kilo, mega, giga, tera bytes level

172 Functions / PHP Code Snippets - page 1/18
Follow WestHost: Twitter Facebook Copyright © 1998–2010, WestHost. All rights reserved.  |  WestHost / Believe in Better Hosting.
Chat Live Now