server/src/app/Libraries/Utils.php
changeset 329 0a2c2ad49d75
parent 261 02e2396bcbbc
child 386 c731ab9b934d
equal deleted inserted replaced
328:04e728651a48 329:0a2c2ad49d75
   132         $merged = array_merge_recursive($data1, $data2);
   132         $merged = array_merge_recursive($data1, $data2);
   133         unset($data1, $data2);
   133         unset($data1, $data2);
   134         return new Graph($graph1->getUri(), $merged, 'php');
   134         return new Graph($graph1->getUri(), $merged, 'php');
   135     }
   135     }
   136 
   136 
       
   137     /**
       
   138      * From http://stackoverflow.com/a/834355
       
   139      */
       
   140     public static function startsWith($haystack, $needle)
       
   141     {
       
   142         $length = strlen($needle);
       
   143         return (substr($haystack, 0, $length) === $needle);
       
   144     }
       
   145 
       
   146     /**
       
   147      * From http://stackoverflow.com/a/834355
       
   148      */
       
   149     public static function endsWith($haystack, $needle)
       
   150     {
       
   151         $length = strlen($needle);
       
   152         if ($length == 0) {
       
   153             return true;
       
   154         }
       
   155 
       
   156         return (substr($haystack, -$length) === $needle);
       
   157     }
       
   158 
   137 }
   159 }