Skip to content

Instantly share code, notes, and snippets.

@openprojdev
Created June 18, 2013 09:29
Show Gist options
  • Save openprojdev/5803965 to your computer and use it in GitHub Desktop.
Save openprojdev/5803965 to your computer and use it in GitHub Desktop.

Revisions

  1. openprojdev created this gist Jun 18, 2013.
    20 changes: 20 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    $cdnHosts = array( //declared in an global config
    'h1.hostname.com',
    'h2.hostname.com',
    'h3.hostname.com',
    'h4.hostname.com'
    );

    /**
    *
    * cdnHostNames
    *
    * @params array $cdnHosts containing all the hostnames
    * @return string the first string value of the circular shifted array
    */
    function cdnHostNames(&$cdnHosts) {
    $cdnHosts = array_merge( array_slice($cdnHosts, 1), array_slice($cdnHosts, 0, 1) ) ;
    return $cdnHosts[0];
    }