PHP code example of eden / collection

1. Go to this page and download the library: Download eden/collection library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eden / collection example snippets


$users = array(
	array(
		'user_name' => 'Chris',
		'user_email' => '[email protected]',
		'user_location' => 'Manila, Philippines'
	),
	
	array(
		'user_name' => 'Dan',
		'user_email' => '[email protected]',
		'user_location' => 'Manila, Philippines'
	),
);

//set user name for all rows
$collection->setUserName('Chris');

// set or get any abstract key for all rows
$collection->setAnyThing();

//collections are iterable
foreach($collection as $model) {        
	echo $model->getUserName().' ';
	echo $model['user_email'];
}
 
//access as array
echo $collection[0]['user_name'];
//set as array
$collection[0]['user_email'] = '[email protected]';