Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Created March 5, 2017 16:28
Show Gist options
  • Select an option

  • Save YurePereira/ac3809f396babc16ca9ec98f9f4abfe5 to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/ac3809f396babc16ca9ec98f9f4abfe5 to your computer and use it in GitHub Desktop.
Reajustes salárial usando a função array_map
<?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