I need a PHP function to transform some data sets.
Input data is CSV format , output is txt. I have added some data sets to play with.
This is how I would like the data transformed:
Two consecutive lines from the CSV represent the start and finish of a process.
[url removed, login to view],8337,,,181976,
[url removed, login to view],8468,,,181976,
It is a start if second value is 8337.
It is a stop if second value is 8468.
The values are suppose to be always in sequence (a line with 8337 always followed by a line with 8468), if not it means corruption of data (see below).
I need this two lines to become one(from example above):
[ 'Session: 181976', new Date(2014,09,25,16,48,43), new Date(2014,09,25,16,53,52)],
So second last value from first line becomes 'Session: value' and then some work with the data stamp.
[url removed, login to view],8337,,,182001,
[url removed, login to view],8468,,,182001,
[ 'Session: 182001', new Date(2014,09,25,16,54,30), new Date(2014,09,25,16,58,13)],
Another example (now for more lines):
[url removed, login to view],8337,,,180226,
[url removed, login to view],8468,,,180226,
[url removed, login to view],8337,,,156780,
[url removed, login to view],8468,,,156780,
[ 'Session: 180226', new Date(2014,09,25,17,47,24), new Date(2014,09,25,17,56,15)],
[ 'Session: 156780', new Date(2014,09,25,17,56,51), new Date(2014,09,25,18,47,27)],
Some additional rules:
- if first line of the file starts with 8468, that line will be discarded.
- if last line of the file finishes with 8337, that line will be discarded.
- if a line with 8337, anywhere in the file, is followed by a line with 8337, the first line will be discarded from resulting data set.
Some of the lines in the file will not have a value for second to last, then it simple becomes 'Session: '.
I hope I managed to make sense, if not, ask away.
The PHP function I will build will receive the CSV file name and will return the text as a string, with each line terminated by a carriage return character. It can be called by an upload file handler and the result di Daha Fazla
Bu iş için 25 freelancer ortalamada $152 teklif veriyor
Hi, This is Gopal for STALLIONi, I am comfortable for the terms you described. Shall we discuss about the task? Please text me here when you ready to discuss about the task. Thanks
Hi I have gone through the details of your project and we find it well within our capabilities. I offer a wide range of services, including Web design, PHP/MySQL web application development, Open sources like Joo Daha Fazla
Hey there. A well detailed task I should say :) This can get me a bit busy for upcoming weekend :) Make contact here or using my contacts from [login to view URL] Cheers mate. Oh, and no payment in adva Daha Fazla
WHOA! Hey there, My name is Faisal Malik and I’m the lead developer of Hexamilesoft Company. We are the web development and social media/SEO/SMO/SEM professionals and having more than 12 year experience along with r Daha Fazla
Hello, I have gone through project description, but I would like to discuss to clear my understanding of requirements. Please message me so we can discuss the requirement in more details, clear doubts and move ah Daha Fazla
Greetings sir, i am an expert freelancer. for this job and your 100% satisfaction is assured if you allow me to serve. Here is the reason. Why you should pick me? a) I am a very expert desktop software/macro/bot/ Daha Fazla
Hi its seems to be interesting and logical project as i have done number of complex and logical projects where the operation are performed after fetching the data from the csv so i can apply all the rules that you have Daha Fazla
expertise in php/mysql,html,html-5,bootstrap,android,css,css-3,cakephp (MVC),LARAVEL 4,symfony-2,YII,have more than 11 year of experience we build more then 100 php/mysql projects worked on joomla,wordpress,magento Daha Fazla
Hello sir, I am a PHP Certified Developer having an experience of more than 5 years in development platform. I am ready to start work with you now. I have read your Project Details and understood 100% that what y Daha Fazla
Hello, I am 4+ years of experienced developer and can do this csv reading and convert it to text file with the formatting the data into array and ready to start working on this. Thanks, Waiting for your reply.
This is an easy project for me. Just award me to start right now. One question: Will the last line of text file has a comma "," at the end or nothing? Thank you in advance.
Hi Employer, ••••>> As we have gone through Requirement on your post for Developing Software. ••••>> We also seen all examples about starting Date and Ending Date. And also gone through the CSV. ••••>> We are Glad Daha Fazla
Hi, I am Thiyagarajan, web developer with strong knowledge in HTML, PHP, Jquery, CSS, Mysql. Recently worked sites. [login to view URL] [login to view URL] [login to view URL] [login to view URL] Daha Fazla
Hi, Greetings of the day! I am writing in response to your job post for a “Write some Software”. After carefully reviewing the experience requirements of the job description, I feel that I am a suitable match Daha Fazla
I can do this fast and cheap. All i need is a good review so be confident I'll do my best. I've already done things like this. PM me for more details. Good luck