Re: Best way to read first 20 characters of a string?

From: Date: Wed, 02 Dec 2009 15:16:47 +0000
Subject: Re: Best way to read first 20 characters of a string?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-300212@lists.php.net to get a copy of this message
On Wed, Dec 2, 2009 at 10:11, Chris Payne <chris_payne@danmangames.com> wrote: > Hi everyone, > > I'm pulling data from a mysql database, but need only the first 20 > characters of each string for a short description, what is the best > method to just grab the first 20 characters from a string regardless > of whether they are letters or numbers? <?php $chars = substr($yourInput,0,20); ?> -- </Daniel P. Brown> daniel.brown@parasane.net || danbrown@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or dedicated servers? Ask me how we can fit your budget!

« previous php.general (#300212) next »