This is a discussion on "dividing one variable and store it into another variables" within the PHP Forum section. This forum, and the thread "dividing one variable and store it into another variables are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
dividing one variable and store it into another variables
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
dividing one variable and store it into another variables
hi all,
i want to know whether it is possible to determine the particular character in the string?? i'm having one variable i.e. $content="Air+Pacific%2C+Model%3A+Airbus%2C+Depart ure%3A+13%2F02%2Fp.m."; i want to divide the above variable into three different variables so the result i'm expecting is : $company="Air Pacific"; $model="Airbus"; $departure="13.02p.m."; so is it possible in php?? anybody is having any idea?? thanx in advance regards amit |
|
|
|
|||
|
Re: dividing one variable and store it into another variables
take a look at http://ca.php.net/manual/en/function.preg-split.php
that function is probaly going to be the main part of it, working the specific details is to much for me at this hour, but good luck |
|
|||
|
Re: dividing one variable and store it into another variables
hi,
i'm able to seperate the one variable and stores it into the three variable but in the following case what should i do?? i'm having one variable i.e. $content="Jet+Airways%2CIndia%2C+Model%3A+Airbus%2 C+Departure%3A+13%2F02%2Fp.m."; In the above variable the company name is also seperated by comma and other things i.e. Model and Departure are also seperated by comma. and my expected result is as below: $company="Jet Airways, India"; $model="Airbus"; $departure="13.02p.m."; so in this case what shall i do?? where the seperator is comma. |
|
||||
|
Re: dividing one variable and store it into another variables
If it's comma seperated, just split each element into an array, then just merge the specific array elements into one...
ie, merge (0) and (1) :- company .... and the same for the other items.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Re: dividing one variable and store it into another variables
hi rob,
thanx for the advice but in this case there are some comapny names are seperated by comma for example: $item1="Air+Pacific%2C+Model%3A+Airbus%2C+Depart ure%3A+13%2F02%2Fp.m."&$item2="Jet+Airways%2CIndia %2C+Model%3A+Airbus%2 C+Departure%3A+13%2F02%2Fp.m" in the above case in the first item the company name is not seperated by comma but in the second item the comapny name is seperated by comma and i want to use the dynamic script for that so that it will classify all the company's names no matter whereever the comma is. |
|
||||
|
Re: dividing one variable and store it into another variables
Well.... if your data is has no integrity of consistant format, the only way you are going to do this is to bodge it.
You need to compile a list of company names that have a comma and cross-check with that list. If you have no consitency in the data, I would be moaning like hell to the data provider to get some consistency and integrity in there.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
![]() |
| Tags |
| dividing, variable, store, variables |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Content Placement + Content Dividing | josephman1988 | Website Planning | 2 | Jan 22nd, 2008 05:02 |
| Add Store to my Website | SawkaWorld | Scripts and Online Services | 3 | Aug 16th, 2007 02:11 |
| Designing an EBAY store | Moonlilly | Web Page Design | 2 | Mar 11th, 2007 10:25 |
| how to store cookies | selphie08 | Flash & Multimedia Forum | 3 | Sep 20th, 2006 01:54 |
| Dividing lines? | joel | Databases | 0 | Nov 3rd, 2005 19:46 |