Location: PHPKode > scripts > PHP Chess classes > php-chess-classes/example.php
    <title>PHPChess \l/ |</title>
    <style type="text/css">
      body {
        font: 90% Verdana, Arial;

      h1 {
        margin: 0px;
        font: 200% Tahoma, Arial;

      hr {
        width: 80%;
        margin: 0px;
        text-align: left;
        color: #aaa;

      .credits {
        font-size: 60%;
        font-weight: normal;


    <h1>PHPChess <span class="credits">by Carlos Reche</span></h1>
    <hr />

      This script is a demonstration of how to use PHPClass. Read the comments for a
      detailed explanation.

    <p style="margin-bottom: 50px;">
      The best browsers to play are Mozilla Firefox and Opera, because they response better
      to these game's javascript functions and they support the Unicode value of chess pieces
      (in case you did not download the GIF or PNG images). But don't worry if you're using
      Internet Explorer, this game should run with no problem in this browser, too.<br />

//Loads PHPChess library to this script
require_once "class.phpchess.php";

// Starts $Chess object
$Chess = new PHPChess();

// Sets the SMTP server to send emails

// Tries to use image files to represent the pieces
if (is_dir("images/"))

// Sets if should diplay the board coordinates

// Sets the size of board squares

// Shows a message to the user (usually last moves or error messages)
echo '<p style="text-align: center;">' . $Chess->message(true) . '</p>';

// Shows the chess board

// Shows the HTML form


Return current item: PHP Chess classes