-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_single.php
More file actions
50 lines (40 loc) · 902 Bytes
/
example_single.php
File metadata and controls
50 lines (40 loc) · 902 Bytes
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
<?php
/**
* File: example_single.php
* Created by Joao Rito on 27/02/18.
* Last modified by Joao Rito on 27/02/18 14:06
* https://github.com/joaorito/php_RenameKeys
*/
include_once ('function.php');
/** Original array */
$original = array(
'DataHora' => date('YmdHis'),
'Produto' => 'Produto 1',
'Preco' => 10.00,
'Quant' => 2
);
/** Map of keys to replace */
$map = array(
'DataHora' => 'Date',
'Produto' => 'Product',
'Preco' => 'Price',
'Quant' => 'Amount'
);
$new = replaceKey($original,$map);
?>
<div style="width: 40%; display: inline-block">
<div>Original Array</div>
<pre style="border: 1px; padding: 5px; ">
<?php
print_r($original);
?>
</pre>
</div>
<div style="width: 40%; display: inline-block">
<div>New Array</div>
<pre style="border: 1px; padding: 5px; ">
<?php
print_r($new);
?>
</pre>
</div>