PHP code example of philicevic / berger

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

    

philicevic / berger example snippets


foreach ($rounds as $round) {
    // get array of fixtures
    $round->fixtures;
    
    // get number of round
    $round->number;
    
    // add fixture to round
    $round->addFixture($fixture);
    
    // remove fixture from round by index
    $round->removeFixture($index);
    
    // format round as array
    $round->toArray();
}

// $round->toArray() will return something like this
[
    [
        [
            'home' => 'A',
            'away' => 'C',
            'round' => 1,
        ],
        [
            'home' => 'B',
            'away' => 'D',
            'round' => 1,
        ],
    ],
    [
        [
            'home' => 'C',
            'away' => 'B',
            'round' => 2,
        ],
        [
            'home' => 'D',
            'away' => 'A',
            'round' => 2,
        ],
    ],
    [
        [
            'home' => 'A',
            'away' => 'B',
            'round' => 3,
        ],
        [
            'home' => 'C',
            'away' => 'D',
            'round' => 3,
        ],
    ],
]