PHP code example of daniel-ac-martin / word-ladder

1. Go to this page and download the library: Download daniel-ac-martin/word-ladder 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/ */

    

daniel-ac-martin / word-ladder example snippets




t  = 'git';
$finish = 'hub';
$steps  = 4;

try
{
	$solution = WordLadder\WordLadder::solve($start, $finish, $steps);
	
	foreach($solution->solution() as $e)
	{
		echo $e->word() . ': ' . substr($e->definition(), 0, 78 - strlen($start)) . "\n";
	}
}
catch(Exception $e)
{
	die('Error: ' . $e->getMessage() . "\n");
}