Created
March 5, 2017 16:28
-
-
Save YurePereira/ac3809f396babc16ca9ec98f9f4abfe5 to your computer and use it in GitHub Desktop.
Reajustes salárial usando a função array_map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Lista de funcionários e seus correspondentes salários: | |
| $listSalary = array( | |
| 'employee_1' => 2100.00, | |
| 'employee_2' => 2500.00, | |
| 'employee_3' => 3000.00, | |
| 'employee_4' => 1300.00, | |
| 'employee_5' => 2100.00, | |
| ); | |
| //Função para reajustes salárial: | |
| function readjustSalary($value) { | |
| $readjustmentValue = 5.0;//5% | |
| return $value + ($value * $readjustmentValue / 100); | |
| } | |
| $listSalary = array_map('readjustSalary', $listSalary); | |
| print_r($listSalary); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment