Jump to here to see how the specific strings are populated with correct note values.
<?php $notes = [ ['C' , '16.35'] , ['C♯' , '17.32'] , ['D' , '18.35'] , ['E♭' , '19.45'] , ['E' , '20.60'] , ['F' , '21.83'] , ['F♯' , '23.12'] , ['G' , '24.50'] , ['G♯' , '25.96'] , ['A' , '27.50'] , ['B♭' , '29.14'] , ['B' , '30.87'] , ['C' , '32.70'] , ['C♯' , '34.65'] , ['D' , '36.71'] , ['E♭' , '38.89'] , ['E' , '41.20'] , ['F' , '43.65'] , ['F♯' , '46.25'] , ['G' , '49.00'] , ['G♯' , '51.91'] , ['A' , '55.00'] , ['B♭' , '58.27'] , ['B' , '61.74'] , ['C' , '65.41'] , ['C♯' , '69.30'] , ['D' , '73.42'] , ['E♭' , '77.78'] , ['E' , '82.41'] , ['F' , '87.31'] , ['F♯' , '92.50'] , ['G' , '98.00'] , ['G♯' , '103.80'] , ['A' , '110.00'] , ['B♭' , '116.50'] , ['B' , '123.50'] , ['C' , '130.80'] , ['C♯' , '138.60'] , ['D' , '146.80'] , ['E♭' , '155.60'] , ['E' , '164.80'] , ['F' , '174.60'] , ['F♯' , '185.00'] , ['G' , '196.00'] , ['G♯' , '207.70'] , ['A' , '220.00'] , ['B♭' , '233.10'] , ['B' , '246.90'] , ['C' , '261.60'] , ['C♯' , '277.20'] , ['D' , '293.70'] , ['E♭' , '311.10'] , ['E' , '329.60'] , ['F' , '349.20'] , ['F♯' , '370.00'] , ['G' , '392.00'] , ['G♯' , '415.30'] , ['A' , '440.00'] , ['B♭' , '466.20'] , ['B' , '493.90'] , ['C' , '523.30'] , ['C♯' , '554.40'] , ['D' , '587.30'] , ['E♭' , '622.30'] , ['E' , '659.30'] , ['F' , '698.50'] , ['F♯' , '740.00'] , ['G' , '784.00'] , ['G♯' , '830.60'] , ['A' , '880.00'] , ['B♭' , '932.30'] , ['B' , '987.80'] , ['C' , '1047.00'] , ['C♯' , '1109.00'] , ['D' , '1175.00'] , ['E♭' , '1245.00'] , ['E' , '1319.00'] , ['F' , '1397.00'] , ['F♯' , '1480.00'] , ['G' , '1568.00'] , ['G♯' , '1661.00'] , ['A' , '1760.00'] , ['B♭' , '1865.00'] , ['B' , '1976.00'] , ['C' , '2093.00'] , ['C♯' , '2217.00'] , ['D' , '2349.00'] , ['E♭' , '2489.00'] , ['E' , '2637.00'] , ['F' , '2794.00'] , ['F♯' , '2960.00'] , ['G' , '3136.00'] , ['G♯' , '3322.00'] , ['A' , '3520.00'] , ['B♭' , '3729.00'] , ['B' , '3951.00'] , ['C' , '4186.00'] , ['C♯' , '4435.00'] , ['D' , '4699.00'] , ['E♭' , '4978.00'] , ['E' , '5274.00'] , ['F' , '5588.00'] , ['F♯' , '5920.00'] , ['G' , '6272.00'] , ['G♯' , '6645.00'] , ['A' , '7040.00'] , ['B♭' , '7459.00'] , ['B' , '7902.00'] ] ; function wrapNote($input) { $letter=$input[0]; $hz=$input[1]; return "<span class='note ".$hz."'>".$letter."</span> <span class='note '>".$hz."</span>"; } foreach($notes as $key=>$note) { switch($notes[$key][1]) { case 82.41: $E=$key; break; case 110.00: $a=$key; break; case 146.80: $d=$key; break; case 196.00: $g=$key; break; case 246.90: $b=$key; break; case 329.60: $e=$key; break; } } $E = array_slice($notes, $E, 13); $a = array_slice($notes, $a, 13); $d = array_slice($notes, $d, 13); $g = array_slice($notes, $g, 13); $e = array_slice($notes, $e, 13); foreach($E as $key=>$value) { print wrapNote($e[$key]); print wrapNote($b[$key]); print wrapNote($g[$key]); print wrapNote($d[$key]); print wrapNote($a[$key]); print wrapNote($E[$key]); print "<br />"; print "<br />"; }