Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

A Really Really Dumb Question

General discussions related to php

Moderators: macek, egami, gesf

A Really Really Dumb Question

Postby MaxDax » Tue Oct 07, 2003 5:14 am

Hi

What function do I use to return the leftmost n characters of a string? In all (well most) other languages I have used have some kind of function that will do this. For example
LEFT(string,numofchars)

I have looked thru the online PHP manual & I can't seem to find a function that will do this.

Sorry to have to ask a dumb question like this. Can anyone give me a clue?

cheers
MaxDax
User avatar
MaxDax
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Oct 07, 2003 5:04 am

Postby swirlee » Tue Oct 07, 2003 9:48 am

If you want to do any sort of string manipulation or access, the section of the manual is (surprise!) Strings. The function you're looking for is the venerable substr().
Last edited by swirlee on Tue Oct 07, 2003 12:19 pm, edited 1 time in total.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby MaxDax » Tue Oct 07, 2003 12:13 pm

Magic!
Thanks swirlee.
I've got no excuse for not remembering that one. I'll go stand in the corner for 10 mins :oops:
MaxDax
User avatar
MaxDax
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Oct 07, 2003 5:04 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.