Generates random php password from [0-9a-z] characters.
1 <?php echo base_convert(rand(0, PHP_INT_MAX) . rand(0, PHP_INT_MAX), 10, 36);
Random string (like password).
1 SELECT CONV(FLOOR(RAND() * 99999999999999), 10, 36);
Interface for object equality comparison and sample model class.
1 <?php
2
3 interface Compareble_Equals
4 {
5 public function equals(self $other);
6 }
7
8
9 class SampleModel extends ActiveRecord implements Comparable_Equals
10 {
11 public function equals(self $other)
12 {
13 return $this['id'] == $other['id'];
14 }
15 }
Simple straightforward algorithm
1 <?php
2
3 function generate_random_password($length = 8)
4 {
5 $charset = 'qwertyuioplkjhgfdsazxcvbnm1234567890';
6 $last_char_pos = strlen($charset) - 1;
7
8 $password = '';
9
10 for ($i = 0; $i < $length; $i++) {
11 $char = rand(0, $last_char_pos);
12 $password .= $charset[$char];
13 }
14
15 return $password;
16 }
.
1 <?php
2
3 function string_ends_with($string, $ending)
4 {
5 $len = strlen($ending);
6 $string_end = substr($string, strlen($string) - $len);
7
8 return $string_end == $ending;
9 }
10
11 ?>
.
1 <?php
2
3 function string_begins_with($string, $search)
4 {
5 return (strncmp($string, $search, strlen($search)) == 0);
6 }
7
8 ?>
.
1 <?php
2
3 function file_extension($filename)
4 {
5 $path_info = pathinfo($filename);
6 return $path_info['extension'];
7 }
8
9 ?>
Why do I need to fill notes?
1 Today: <?php echo date('Y-m-d') ?> <br />
2 Tomorrow: <?php echo date('Y-m-d', strtotime('+1 day')) ?> <br />
3 1 week later: <?php echo date('Y-m-d', strtotime('+1 week')) ?> <br />
4 1 month later: <?php echo date('Y-m-d', strtotime('+1 month')) ?> <br />
Pages : 1