diff --git "a/Retos/Reto #19 - AN\303\201LISIS DE TEXTO [Media]/php/kodenook.php" "b/Retos/Reto #19 - AN\303\201LISIS DE TEXTO [Media]/php/kodenook.php" new file mode 100644 index 0000000000..ba848712a7 --- /dev/null +++ "b/Retos/Reto #19 - AN\303\201LISIS DE TEXTO [Media]/php/kodenook.php" @@ -0,0 +1,41 @@ + count(str_split($largest))) { + $largest = $value; + } + if (str_ends_with($value, '.')) { + $sentences++; + } + $value = str_replace('.', '', $value); // Corregir aquĆ­ + array_push($letter_counts, count(str_split($value))); + } + + $response = 'Words count: ' . count($txt) . PHP_EOL; + $response .= 'Largest word: ' . $largest . PHP_EOL; + $response .= 'Sentences count: ' . $sentences . PHP_EOL; + $response .= 'Average letter: ' . array_sum($letter_counts) / count($letter_counts) . PHP_EOL; + + return $response; +} + +$sentence = 'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Minus laudantium numquam quam ex velit consequatur in repellendus praesentium ab? Esse dolor voluptates recusandae at, odit necessitatibus provident sint placeat. Recusandae.'; +echo stats($sentence);