PHP 8.4.24 Released!

Voting

: max(seven, four)?
(Example: nine)

The Note You're Voting On

pugazhenthi k
13 years ago
<?Php 

### SUB STRING  BY WORD USING substr() and strpos()  #####

### THIS SCRIPT WILL RETURN PART OF STRING  WITHOUT WORD BREAK ###

$description = ‘your description here your description here your description here your description here your description here your description here your description hereyour description here your description here’  // your description here .

$no_letter = 30 ;

if(strlen($desctiption) > 30 )
{
     echo substr($description,0,strpos($description,’ ‘,30));             //strpos to find ‘ ‘ after 30 characters.
}
else {
     echo $description;
}

?>

<< Back to user notes page

To Top