Skip to content

Instantly share code, notes, and snippets.

@magmastonealex
Last active December 25, 2015 18:49
Show Gist options
  • Save magmastonealex/7023743 to your computer and use it in GitHub Desktop.
Save magmastonealex/7023743 to your computer and use it in GitHub Desktop.
<?php
$arr = array(3,6,7,9,10);
$tot = 0;
foreach($arr as $val){
$tot += $val;
}
echo $tot/count($arr);
?>
<?php
$arr = "NOISE";
$alpha ="IOSHZXN";
for( $i=0; $i < strlen($arr);$i++){
$achar = $arr[$i];
$bad = 1;
for($x=0; $x<strlen($alpha); $x++){
if($alpha[$x] == $achar){
$bad = 0;
}
}
if($bad == 1){
die("NO");
}
}
echo "YES!";
?>
<?php
$arr = array(3,6,7,9,10,6,7,2,1);
$count = 0;
foreach ($arr as $value) {
if($value >= 5){
$count++;
}
}
echo $count;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment