What else?
Berichten: 1180
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
class Security
{
public function Values ( $values )
{
if ( !is_array ( $values ) )
{
throw new exception ( ' Value is not in array. ' );
}
else
{
if ( ! $this->values )
{
foreach ( $values as $value )
{
$this->value[] = addslashes ( $value ) ;
}
}
else
{
throw new exception ( ' Value already specified. ' );
}
}
}
public function Numeric ( $value )
{
if ( ! is_int ( $value ) OR ! is_float ( $value ) )
{
throw new exception ( ' Value is not an integer or float value. ' );
}
}
public function Alpha ( $value )
{
if ( ! preg_match('/^[a-zA-Z]+$/i', $value) )
{
throw new exception ( ' Value is not alphabetic. ' );
}
}
}
|
|
|
ja ik weet er is:
is_numeric / ctype_digit / ctype_alpha
maar gewoon een class schrijven voor de eerste keer en ja ik weet ook exceptions worden nog nergens opgevangen daar moet ik nog 1 en ander over lezen [a]
Laatst gewijzigd door Patrick op 2010-04-01 23:12:44
01-04-2010 23:04
Dit topic is 140 keer bekeken door 1 verschillende leden
Reacties op: "Eerste class"
1
Reageer op: "Eerste class"
1