Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function factorialArray($arrayNombre)
- {
- $factorials = array();
- if (is_array($arrayNombre) && is_int($arrayNombre)) {
- foreach ($arrayNombre as $numero) {
- for ($i = $numero - 1; i > 1; $i--) {
- $numero = $numero * $i;
- }
- $factorials[] = $numero;
- }
- foreach ($factorials as $factorials){
- echo $factorials;
- }
- }else{
- return false;
- }
- }
- $nombres = array(15, 42, 12, 22, 77);
- factorialArray($nombres);
Add Comment
Please, Sign In to add comment