3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php print "<pre>"; require_once("guitar_user-input.php"); class guitar_variable extends user_input{ /* public $a,$b,$c, $a1,$b1,$c1, $a2,$b2,$c2, $x,$y,$z, $x1,$y1,$z1, $x2,$y2,$z2, $tmp ;*/ function check(){ echo count(array_map('json_decode', array_unique(array_map('json_encode', $this->fretboard_overhang)))) . '<br>'; if( count(array_map('json_decode', array_unique(array_map('json_encode', $this->fretboard_overhang)))) == 1 ){ //equal // $this->fretboard_overhang[0] = $this->fretboard_overhang[0][0]; return 1; } else if ( ($this->fretboard_overhang[0][0] == $this->fretboard_overhang[0][1]) && ($this->fretboard_overhang[1][1] == $this->fretboard_overhang[1][0]) ){ // $this->fretboard_overhang[0] = $this->fretboard_overhang[0][0]; // $this->fretboard_overhang[1] = $this->fretboard_overhang[1][0]; return 2; } else { //foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($this->fretboard_overhang)) as $i) { //$this->tmp += count($i);} return 2; } } /* string di nut < string di bridge = udah string di nut > string di bridge = belum string di nut = string di bridge = belum */ function __construct(){ $check = $this->check() - 1; global $b; $a = pow($this->string[0],2); //panjang string kuadrat $b = ($this->string[1][1] - $this->string[1][0]) / 2; //tinggi string di bridge di kurangi tinggi string di nut dibagi 2 $this->fret_length[0][0] = $this->string[0] - ( $this->string[0] / pow(2,1/12) ); //panjang fret pertama for($i = 0; $i <= $check; $i++){ // -----------tanpa overhang---------- // $this->fretboard[0][$i] = pow( $a + ( pow($b,2) ), 1/2); //panjang total fretboard miring $this->nut_angle[$i] = 90 - rad2deg(acos( ( pow($b,2) + pow($this->fretboard[0][$i],2) - $a ) / (2*($b)*$this->fretboard[0][$i]) )); //aturan cosinus dan 180 derajat $this->fret[0][0][$i][0] = ( $this->fret_length[0][0] * sin(deg2rad(90)) ) / sin(deg2rad( 180 - ($this->nut_angle[$i] + 90) )); //aturan sinus, panjang fret miring pertama $this->fret[0][0][$i][1] = 0; $this->fret[0][1][$i][0] = ( sin(deg2rad( $this->nut_angle[$i] )) * $this->fret_length[0][0] ) / sin(deg2rad( 180 - ($this->nut_angle[$i] + 90) )); // ^^^^ aturan sinus, panjang fretwire di fret miring / 2 ^^^^ $this->fret[0][1][$i][1] = 0; // -----------dengan overhang---------- // $tmp0[$i] = 90 - $this->nut_angle[$i]; // sudut fretboard overhang di nut bagian atas, karena segitiga siku-siku if($this->fretboard_overhang[0][$i] == 0){ $tmp1[$i] = $this->fretboard[0][$i]; $tmp2[$i] = 90; // $tmp3[$i] = $this->nut_angle[$i]; // $tmp4[$i] = 90; } else{ // segitiga pecahan atas // $tmp1[$i] = pow( ((pow($this->fretboard[0][$i],2)+pow($this->fretboard_overhang[0][$i],2)) - (2*$this->fretboard[0][$i]*$this->fretboard_overhang[0][$i]*cos(deg2rad($tmp0[$i]))) ), 1/2); // aturan cosinus, panjang diagonal 1 total fret miring overhang $tmp2[$i] = rad2deg(acos( ( pow($this->fretboard_overhang[0][$i],2) + pow($tmp1[$i],2) - pow($this->fretboard[0][$i],2) ) / (2*$this->fretboard_overhang[0][$i]*$tmp1[$i]) )); // aturan cosinus, sudut fretboard miring overhang di nut bagian bawah pecahan atas // $tmp3[$i] = 180 - $tmp0[$i] - $tmp2[$i]; //aturan 180 derajat, sudut fretboard miring overhang di bridge bagian atas pecahan atas // segitiga pecahan bawah // // $tmp4[$i] = 180 - $tmp0[$i] - $tmp3[$i]; // aturan sudut bersebrangan dan 180 derajat, sudut fretboard miring overhang di bridge bagian atas pecahan bawah } $this->fretboard[1][$i] = pow( pow($this->fretboard_overhang[1][$i],2) + pow($tmp1[$i],2) - 2*$this->fretboard_overhang[1][$i]*$tmp1[$i]*cos(deg2rad($tmp2[$i])) ,1/2); // ^^^^ aturan cosinus, panjang total fretboard miring overhang ^^^^ // $this->fret_overhang[0][0][$i][0] = var_dump($tmp0[$i]); var_dump($tmp1[$i]); var_dump($tmp2[$i]); // var_dump($tmp3[$i]); // var_dump($tmp4[$i]); echo'<br>'; } } } class guitar_construct extends guitar_variable{ function __construct(){ parent::__construct(); global $b; for($i = $this->fret_range[0]; $i <= $this->fret_range[1]; $i++){ $this->fret_length[0][$i] = ($this->fret_length[0][0] * ($this->string[0] - ($this->fret_length[1][$i-1] + $this->fret_length[0][$i-1])) ) / $this->string[0]; //panjang fret $this->fret_length[1][$i] = $this->fret_length[0][$i] + $this->fret_length[1][$i-1]; //panjang fret dari nut $this->fret[$i][0][0][0] = ($this->fret[0][0][0][0] * ($this->fretboard[0][0] - ($this->fret[$i-1][0][0][1] + $this->fret[$i-1][0][0][0])) ) / $this->fretboard[0][0]; //panjang x1 $this->fret[$i][0][0][1] = $this->fret[$i][0][0][0] + $this->fret[$i-1][0][0][1]; // panjang x1 dari nut $this->fret[$i][1][0][0] = ($this->fret[0][1][0][0] * ($b - ($this->fret[$i-1][1][0][1] + $this->fret[$i-1][1][0][0])) ) / $b; //panjang y1 $this->fret[$i][1][0][1] = $this->fret[$i][1][0][0] + $this->fret[$i-1][1][0][1]; // panjang y1 dari nut } // panjang fretboard sebenarnya = } } $test = new guitar_construct(); print "<br>"; var_dump($test); print "</pre>"; ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
<pre> Warning: require_once(guitar_user-input.php): failed to open stream: No such file or directory in /in/cXG9X on line 4 Fatal error: require_once(): Failed opening required 'guitar_user-input.php' (include_path='.:') in /in/cXG9X on line 4
Process exited with code 255.
Output for hhvm-3.12.0
<pre> Fatal error: Uncaught Error: File not found: guitar_user-input.php in /in/cXG9X:4 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.0
<pre> Fatal error: File not found: guitar_user-input.php in /in/cXG9X on line 4
Process exited with code 255.