Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@matiasa18
Created April 22, 2012 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiasa18/2467258 to your computer and use it in GitHub Desktop.
Save matiasa18/2467258 to your computer and use it in GitHub Desktop.
count "-"
<?php
$count = 0;
$string = '-----hello--';
for ($i=0; $i<strlen($string); $i++) {
if ($string[$i] == '-') {
$count ++;
}
}
echo $count;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment