-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.php
99 lines (91 loc) · 1.82 KB
/
index.php
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php include 'faker.php'; ?><html>
<head>
<title>Generating random data</title>
</head>
<body>
<?php
$arr = array(
'Name' => array(
'name',
'first_name',
'surname',
'prefix',
'suffix',
),
'Address' => array(
'street_suffix',
'street_name',
'street_address',
'abode_address',
array( 'abode_address', true ),
'uk_county',
'uk_country',
'post_code',
'us_state',
'us_state_abbr',
'zip_code'
),
'Phone_Number' => array(
'phone_number'
),
'Company' => array(
'name',
'suffix',
'catch_phrase',
'bs',
),
'Internet' => array(
'domain_suffix',
'domain_word',
'domain_name',
'user_name',
array( 'user_name', 'caius durling' ),
'email',
array( 'email', 'caius durling' ),
'free_email',
array( 'free_email', 'caius durling' ),
),
'Lorem' => array(
'words',
'sentence',
'sentences',
'paragraph',
'paragraphs',
)
);
?>
<table>
<legend>$f = new Faker</legend>
<tr>
<th>PHP Statement</th>
<th>Output</th>
</tr>
<?php
$f = new Faker;
foreach ($arr as $class => $methods) {
foreach ($methods as $method) {
if ( is_array( $method ) ) {
?>
<tr>
<td>$f-><?php echo $class ?>-><?php echo $method[0] ?>( <?php echo $method[1] ?> )</td>
<?php if ( strpos( $method[1], "'" ) ): ?>
<td><?php echo $f->$class->$method[0]( '$method[1]' ) ?></td>
<?php else: ?>
<td><?php echo $f->$class->$method[0]( $method[1] ) ?></td>
<?php endif ?>
</tr>
<?php
} else {
?>
<tr>
<td>$f-><?php echo $class ?>-><?php echo $method ?></td>
<td><?php echo $f->$class->$method ?></td>
</tr>
<?php
}
}
}
?>
</table>
</body>
</html>