<?php
/******************************************************************************
This code for test the recive of a textarea and covert it to array
contains the words greaded than 10 char.
*******************************************************************************/
$textarea_value = "Hello world! to my test code. keep learning!";
// $textarea_value = $_GET['textarea'] ;
$errors= array();
function textarea_to_array($textarea){
$array = str_word_count($textarea,1);
if (count($array) > 5 ) {
return $array;
}
else{
global $errors;
$error = "the textarea words must be greater than 10.";
array_push($errors, $error);
}
}
print_r(textarea_to_array($textarea_value));
print_r($errors);