PHP code example of briandavidclark / ramuda

1. Go to this page and download the library: Download briandavidclark/ramuda 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/ */

    

briandavidclark / ramuda example snippets


use ramuda\R;

$users = [
   ['id'=>'45', 'fName'=>'Jane', 'lName'=>'Doe'],
   ['id'=>'22', 'fName'=>'John', 'lName'=>'Doe'],
   ['id'=>'99', 'fName'=>'John', 'lName'=>'Smith']
];

$listToSelect = R::pipe(
   R::filter(R::propEq('lName', 'Doe')),
   R::sortBy(R::prop('id')),
   R::map(function($x){
      return "<option value='{$x['id']}'>{$x['fName']} {$x['lName']}</option>";
   }),
   R::join(''),
   R::wrapWith(['<select>', '</select>'])
);

echo $listToSelect($users);