<?php //1 Muestra 56 //2 $colores=["Rojo","naranja","amarillo","verde","cian","azul","magenta"]; //3 $res=1; for($i=1;$i<=12;$i++){ $res*=$i; } echo $res; //4 function inicioFin($cadena){ return substr($cadena,0,1)==substr($cadena,-1); } //5 function sumaArray($array){ $suma=0; foreach($array as $v){ $suma+=$v; } return $suma; } function sumaArrayPro($array){ return array_sum($array); } //6 function invertirCad($array){ $res=[]; foreach($array as $v){ $res[]= strrev($v); } return $res; } //7 function arrayAleatorio($tam,$min,$max){ $res=[]; for($i=0;$i<$tam;$i++){ $res[]=mt_rand($min,$max); } return $res; } //8 function finde(){ return date("w")==0 || date("w")==6; } //9 function quitar($cadena,$letras){ $cadena= utf8_encode($cadena); for($i=0;$i<strlen($letras);$i++){ $cadena= str_replace(substr($letras,$i,1), "", $cadena); } return utf8_decode($cadena); } function contarConsonantes($cadena){ $cadena= strtolower($cadena); $c=quitar($cadena,"bcdfghjklmnñpqrstvwxyz"); return strlen($cadena)-strlen($c); } function masConsonantes($a,$b){ if (contarConsonantes($a)> contarConsonantes($b)){ return $a; } else { return $b; } }