當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Strings::sanitize_u方法代碼示例

本文整理匯總了PHP中Strings::sanitize_u方法的典型用法代碼示例。如果您正苦於以下問題:PHP Strings::sanitize_u方法的具體用法?PHP Strings::sanitize_u怎麽用?PHP Strings::sanitize_u使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Strings的用法示例。


在下文中一共展示了Strings::sanitize_u方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getByName

 public function getByName($name, $type, $transpose = 0)
 {
     $this->name = Strings::ucfirst($name);
     $this->type = Strings::sanitize_u($type);
     $notes = $this->getNotes();
     if (in_array($this->type, array_keys($this->config))) {
         $start = array_keys($notes, $this->name);
         $note_sum = sizeof($notes) - 1;
         if (count($start) > 0) {
             if ($start[0] + $transpose < 0) {
                 $current = $start[0] + $transpose + $note_sum + 1;
             } else {
                 if ($start[0] + $transpose > $note_sum) {
                     $current = $start[0] + $transpose - $note_sum - 1;
                 } else {
                     $current = $start[0] + $transpose;
                 }
             }
             $this->chord[] = $notes[$current];
             foreach ($this->config[$this->type] as $num) {
                 $current += $num;
                 if ($current > $note_sum) {
                     $current -= $note_sum + 1;
                 }
                 $this->chord[] = $notes[$current];
             }
             return $this->chord;
         }
     }
 }
開發者ID:Acoustics,項目名稱:jbLibrary,代碼行數:30,代碼來源:chord.php

示例2: getByChords

 public function getByChords($chords)
 {
     $_chord = new Chord();
     $notes = array();
     foreach ($chords as $chord) {
         $name = Strings::ucfirst($chord["name"]);
         $type = Strings::sanitize_u($chord["type"]);
         $_chord->getByName($name, $type);
         $notes = array_merge($notes, $_chord->notes);
     }
     $notes = array_unique($notes);
     $this->possible = array();
     $scales = $this->getTypes();
     for ($i = 0; $i < 12; $i++) {
         foreach ($scales as $scale) {
             $this->scale = null;
             $this->getByName("C", $scale, $i);
             if ($this->containsNotes($notes, $this->scale)) {
                 array_push($this->possible, array("name" => current($this->scale), "type" => $scale));
             }
         }
     }
     return $this->possible;
 }
開發者ID:Acoustics,項目名稱:jbLibrary,代碼行數:24,代碼來源:scale.php


注:本文中的Strings::sanitize_u方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。