PHP ports of the examples in David Kopec's book "Classic Computer Science Problems in Python" You can download the original Python examples from David's repository.
- PHP 7.2 or newer to run the examples
- PHP 7.3 or newer to run the unit tests
All examples have been designed to be used both on the command line interface (CLI) and in a web browser (served by a web server running the required PHP version).
In order to run the examples on CLI, just cd into the Chapter{n} directories and type php filename
. Make sure to use the cli and not the web files for chapters 8 and 9.
If you want to run the web examples, make sure that the complete example directory is availabe via web server, and then point your browser to http://{your-website/examples-folder}/index.html
.
This project contains PHPUnit unit tests for most of the PHP classes. In order to run them, perform the following steps:
- Make sure you have the latest version of Composer
- In the project's main directory, run
composer install
- Change to the
tests
subdirectory:cd tests
- Run all tests:
../vendor/phpunit/bin/phpunit .