₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,347,363 members, 8,527,642 topics. Date: Tuesday, 01 December 2026 at 04:21 AM

Toggle theme

Trivial Question Csv/arraycollection - Webmasters - Nairaland

Nairaland Forum › Science/Technology › Webmasters › Trivial Question Csv/arraycollection (865 Views)

1 Reply (Go Down)

Trivial Question Csv/arraycollection by Nobody:
Hi Guys yes Pc Guru has come with his wahala again, i wrote a PHP CommandLine to extract a CSV which was converted from an Excel file containing Multi-choice questions for Moodle (a Learning management system) however, because of the time limit, i won't lie the scripts works but its more 100% hardcoded but now the job is done, and subsequent request like this will obviously come, the question is i have decided to write a class that dumps CSV to a good Data Structure, the Dilemma is

1. Should i take the CSV and Dump to a ArrayCollection (i know PHP has no such) this will be a lot easier, and make each field have a magic get and setter method so if a field like "text" exists, getText and SetText will automatically alter it.

2. Or Do i just simply dump the CSV to Arrays and just pick from them.

Now with the first i'm hoping to do the above

//Getters
$ArrayyCollection->getRow(1)->getField(" item "wink->getValue() ; //Long Method
$ArrayCollection->getRow(1)->item; //Short Hand Magic Method
//Setters
$ArrayCollection->getRow(1)->getField(" item "wink->setValue(" title "wink;
$ArrayCollection->getRow(1)->item="value";



anyway i know there are better coders than me over here so i won't mind some insights on it. thanks a lot, i intend to use this to create a simple class that takes CSV and exports them to MoodleXML for Quizzes.
Re: Trivial Question Csv/arraycollection by Nobody: 5:46pm On Dec 06, 2012
Arggghhh damn smileys
Re: Trivial Question Csv/arraycollection by Nobody: 9:18am On Dec 07, 2012
No PHP5 Developers here undecided huhhuh??
Re: Trivial Question Csv/arraycollection by Nobody: 3:06pm On Dec 16, 2012
Hey Guys, just thot i share it not sure if anyone interested, but i used the Code from a git i saw, since it makes no sense writing what someone has already done for people to clone,
https://github.com/kurijov/php-array-collection

Its not the exact thing i needed but it worked anyway.
1 Reply

How To Import Contacts (using CSV) On Facebook? • Reading Different Versions Of Excel Data (CSV,XLS,XLSX) With Phpexcel Library • C# Csv Parser • 2 • 3 • 4

Hey Guys, So Why Do People Pay For Web Hosting When Webs.com Is Free ? • Yawatide, DHML And Others Please Help! • I Will Create Google Adsense Account For You In 1 Day