equal
deleted
inserted
replaced
4073 } |
4073 } |
4074 |
4074 |
4075 // Might as well start the profiler, it has no external dependencies except from this file. |
4075 // Might as well start the profiler, it has no external dependencies except from this file. |
4076 profiler_start(); |
4076 profiler_start(); |
4077 |
4077 |
|
4078 /** |
|
4079 * Returns the number of times a character occurs in a given string. |
|
4080 * @param string Haystack |
|
4081 * @param string Needle |
|
4082 * @return int |
|
4083 */ |
|
4084 |
|
4085 function get_char_count($string, $char) |
|
4086 { |
|
4087 $char = substr($char, 0, 1); |
|
4088 $count = 0; |
|
4089 for ( $i = 0; $i < strlen($string); $i++ ) |
|
4090 { |
|
4091 if ( $string{$i} == $char ) |
|
4092 $count++; |
|
4093 } |
|
4094 return $count; |
|
4095 } |
|
4096 |
|
4097 /** |
|
4098 * Returns the number of lines in a string. |
|
4099 * @param string String to check |
|
4100 * @return int |
|
4101 */ |
|
4102 |
|
4103 function get_line_count($string) |
|
4104 { |
|
4105 return ( get_char_count($string, "\n") ) + 1; |
|
4106 } |
|
4107 |
4078 //die('<pre>Original: 01010101010100101010100101010101011010'."\nProcessed: ".uncompress_bitfield(compress_bitfield('01010101010100101010100101010101011010')).'</pre>'); |
4108 //die('<pre>Original: 01010101010100101010100101010101011010'."\nProcessed: ".uncompress_bitfield(compress_bitfield('01010101010100101010100101010101011010')).'</pre>'); |
4079 |
4109 |
4080 ?> |
4110 ?> |