Answers for "how to set limit in php"

PHP
4

php time limit

set_time_limit(120); // Time in seconds
set_time_limit(0);   // unlimited
Posted by: Guest on September-07-2021
0

php limit words

function limit_text($text, $limit) {
    if (str_word_count($text, 0) > $limit) {
        $words = str_word_count($text, 2);
        $pos   = array_keys($words);
        $text  = substr($text, 0, $pos[$limit]) . '...';
    }
    return $text;
}

echo limit_text('Hello here is a long sentence that will be truncated by the', 5);
Posted by: Guest on November-04-2021
0

PHP Time Limit:

set_time_limit(300);
Posted by: Guest on February-05-2021

Browse Popular Code Answers by Language