Skip to main content

Tic Tac Toe Game Using PHP Free Source Code


This is a Tic Tac Toe Game that I developed using PHP Language. The game project can be played by 2 players. The source code will help you to learn and understand how to create a simple game like this using the PHP Language. It has a simple user interface and is user-friendly.

About the Tic Tac Toe Game in PHP

The project source code uses the PHP $_SESSION to store the game data temporarily. Before the players can start the game, they will first enter their name on their chosen side either they want to play as the X or O. The system also stores the players' score records and shows them every time the game has ended.

How to Play

  1. Enter the players on their chosen sides. Then click start.
  2. The system will display the players' names for each player's turn. The player's move will be confirmed/submitted by clicking the Play Button.
  3. The first player to align their marks horizontally, vertically, or diagonally will be the winner for the game.


  • Players Choosing Side Form/Page
  • Game Page
  • Score Board Page

The source code is free to download on this website. Feel free to download them and modify the source code the way you wanted to enhance your programming capabilities.

How to Run??


  • Download and Install any local web server such as XAMPP/WAMP.
  • Download the provided source code zip file. (download button is located below)


  1. Open your XAMPP/WAMP's Control Panel and start Apache.
  2. Extract the downloaded source code zip file.
  3. If you are using XAMPP, copy the extracted source code folder and paste it into the XAMPP's "htdocs" directory. And If you are using WAMP, paste it into the "www" directory.
  4. Browse the Tic Tac Toe Game in a browser. i.e. http://localhost/tic-tac-toe/.


There you go! You can now test and play the Tic Tac Toe Game on your end. I hope this simple PHP Game project will help you with what you are looking for. Feel free to use the code and ask me anything you want on it.

Developed/Uploaded By:

Enjoy :)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment