cs50/php

CS50 library for PHP

v6.0.1 2020-12-05 18:06 UTC

This package is not auto-updated.

Last update: 2024-12-21 19:10:58 UTC


README

Development

Requires Docker Toolbox.

docker-compose run cli # runs CS50 CLI

Installation

Ubuntu:

$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
$ sudo apt-get install php-cs50

Fedora

$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.rpm.sh | sudo bash
$ sudo yum install php-cs50

From Source

  1. Download the latest release from https://github.com/cs50/php-cs50/releases
  2. Extract php-cs50*
  3. cd php-cs50
  4. make install # may require sudo

By default, we install to /usr/local/share/php. If you'd like to change the installation location, run DESTDIR=/path/to/install make install as desired.

Usage

// assumes CS50.php is in include_path
require("CS50.php");

...

$c = CS50\get_char();
$f = CS50\get_float();
$i = CS50\get_int();
$s = CS50\get_string();

TODO

  • Decide whether to add CS50.eprintf.
  • Add tests.
  • Review ID.php, Database.php, etc.