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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 2, 2009 at 10:11, Chris Payne <chris_payne@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux