PHP code example of vlauciani / fortran-formatter

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

    

vlauciani / fortran-formatter example snippets



namespace App\Api\Controllers;
use App\Http\Controllers\Controller;
use VLauciani\FortranFormatter\Traits\FortranFormatTrait;

class MyController extends Controller
{
    use FortranFormatTrait;
    
    public function convertData()
    {
	      $str_pad_string = '*';
	      $example_1 = self::fromFortranFormatToString('A5', 'ACER', $str_pad_string, STR_PAD_RIGHT); // return: 'ACER*'
	      $example_2 = self::fromFortranFormatToString('A2', 'IV', $str_pad_string); // return: IV
	      $example_3 = self::fromFortranFormatToString('F3.0', '12', $str_pad_string); // return: *12
	      $example_4 = self::fromFortranFormatToString('6X', null, $str_pad_string); // return: ******
	      $example_5 = self::fromFortranFormatToString('I6', '123', $str_pad_string); // return: ***123
    }
}