Skip to content
Advertisement

PHP – how count percent of each value in array

In PHP, I have an array:

JavaScript

I want to add 5% to each element of the array $a, so that it looks like this:

JavaScript

I do not want to use foreach.

Advertisement

Answer

Try this

JavaScript

Output :-

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement