Clone this wiki locally
Welcome to the Megarray wiki!
Megarray takes a leaf out of languages like MATLAB’s book and gives PHP some super powerful array functionality wrapped up in a class.
MIT Licensed. Would love to know if you’re using Megarray so get in touch if you do.
Why use Megarray?
The core feature which is there is Selectors. With selectors you can quickly grab the data you want without having to do too much work yourself. And we all know coders are lazy :) I am planning on adding a lot more to the class in the future, and if you have ideas as to what should be there, lemme know!
Yeah, there aren’t many docs at the moment, but I’ve tried to make sure the class source is as documented as possible. Have a looksy.
The index.php file in the repository also serves as the testbed / proving ground for the class, so that contains all the demo’s of the system.
Include download the class (just one file, grab it from the repo), include and use!
<?php include('Megarray.class.php'); $array = Megarray::factory(array('element1', 'element2', 'element3')); $array2 = new Megarray(); $array2 = 'element1'; $array2 = 'element2'; $array2['e3'] = 'element3; ?>
If you need to get the array back as a normal PHP array, use
$normal_array = $array->as_array();
Whilst I’ll try and keep the repo here as stable as possible, this project is under development and might be unstable / unfinished. If you’d like to help out, fork me baby! Or if you have ideas as to what you’d like to add in, get in touch.