PHP RenameKeys
This PHP function could be used to automatic rename keys from a object or a array (single or multidimensional).
Example: Single Arrays
Click to see the code example_single.php
Original Array
Array ( [DataHora] => 20180227142904 [Produto] => Produto 1 [Preco] => 10 [Quant] => 2 ) |
New Array
Array ( [Date] => 20180227142904 [Product] => Produto 1 [Price] => 10 [Amount] => 2 ) |
Example: Multidimensional Arrays
Click to see the code example_multi.php
Original Array
Array ( [DataHora] => 20180227162644 [Produto] => Array ( [0] => Array ( [Nome] => Produto 1 [Preco] => 10 [Estoque] => 1 ) |
New Array
Array ( [Date] => 20180227162644 [Product] => Array ( [0] => Array ( [Name] => Produto 1 [Price] => 10 [Avaiable] => 1 ) |