PHP code example of fromholdio / silverstripe-commonancestor
1. Go to this page and download the library: Download fromholdio/silverstripe-commonancestor 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/ */
fromholdio / silverstripe-commonancestor example snippets
$exampleOne = [VideoPost::class, ArticlePost::class];
$resultOne = CommonAncestor::get_closest($exampleOne);
// returns 'BlogPost'
$exampleTwo = [VideoPost::class, BlogPost::class];
$resultTwo = CommonAncestor::get_closest($exampleTwo);
// returns 'BlogPost'
$exampleThree = [VideoPost::class, BlogHolder::class];
$resultThree = CommonAncestor::get_closest($exampleThree);
// returns 'Page'