PHP code example of eduluz1976 / action

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

    

eduluz1976 / action example snippets



function multiply($x,$y) {
    return $x * $y;
}

$action = Action::factory('multiply()');

$response = $action->exec(2,5);

// result = 10



$action = Action::factory('MyClass::myFunction()',[],['constructor'=>[1,'string',false]]);




class MyClass {


    public function myFunction($id, $fieldName) {
        // ...
        return [
            'id' => $id,
            'field_name'=> $fieldName
        ];
    }

}


$action = Action::factory('MyClass::myFunction()', [1, 'name']);

$response = $action->exec();

print_r($response);
 


$url = 'post;https://username:[email protected]:9090/path?arg=value#anchor';

$action = Action::factory($url);

$response = $action->exec();