Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2005, 08:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default newbie question- cutting a string apart

I have looked everywhere but cannot seem to find how to cut out part of a string. I am wanting the first 5 characters of the string. The string has no spaces or unique identifiers so i can't really use explode.

Many Thanks
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old June 21st, 2005, 04:53 AM
Authorized User
 
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use substr

Example:
$string_i_want = substr($start_string,0,5);

What that says is I want characters 0 to 5 from start_string and store them in string_i_want.
You can, if you want, store them back in start_string but that would overwrite any values held previously.

I hope that helps.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question savoym JSP Basics 1 August 16th, 2006 03:15 AM
Cutting a character from a string arnabghosh Classic ASP Basics 2 August 18th, 2005 07:44 AM
newbie question Warbird XML 0 May 11th, 2005 08:41 AM
newbie - Query to String dholcomb Access VBA 3 August 16th, 2004 09:44 AM
Newbie question maccer88 Access 1 October 18th, 2003 05:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.