selecting data from a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ridwan
Forum Commoner
Posts: 55
Joined: Thu Aug 22, 2002 3:15 am

selecting data from a string

Post by ridwan »

Is it possible within php to select data from a certain character to another character and display the info within that selection. I dont know if the substr function will be able to do this if so can some one direct me please?

thanks
ckuipers
Forum Commoner
Posts: 61
Joined: Mon Mar 24, 2003 6:10 am

Post by ckuipers »

Please clarify a bit more what it is you are trying to do...
ridwan
Forum Commoner
Posts: 55
Joined: Thu Aug 22, 2002 3:15 am

an example

Post by ridwan »

say there is info that is in between slashes and I want to select that info and disregard the rest for example:

asdasdasdda/example/asdasdasdas

how do i extract 'example' out of the previous string ?

thanks
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

thats kindof a poor example... there are sooo many ways you could do that.

i suggest reading up on String Functions at the php.net website.
ridwan
Forum Commoner
Posts: 55
Joined: Thu Aug 22, 2002 3:15 am

thanks....

Post by ridwan »

well could you at least throw me a bone here, that's kinda what forums are for to help each other out I'm not askin for full blown code it's just the basic function i need i'll look up the rest
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Re: thanks....

Post by twigletmac »

ridwan wrote:well could you at least throw me a bone here, that's kinda what forums are for to help each other out I'm not askin for full blown code it's just the basic function i need i'll look up the rest
The 'bone' is the manual:
http://www.php.net/manual/en/ref.strings.php

What you asked could be done in a number of ways, look at the string functions and see which one suits the specific task you are trying to do.

People here are more than happy to help out generally but you have to also help yourself sometimes - we can't tell you the specific function you need because we have no idea exactly what you are trying to do (yes you have given us a general idea but that's why you've got a general answer).

Please go look at the manual.

Mac
Post Reply