Turning Learners Into Developers
Codekilla
CODEKILLA
// projects.php

10 Best PHP Projects

Hand-picked and ordered easiest → hardest — each with complete code and expected output. Build these to turn lessons into a portfolio.

Back to PHP course
// solution.code
php
<?php
// FILE: includes/header.php
// Common header for all pages
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo $pageTitle ?? 'My Portfolio'; ?></title>
    <style>
        body { font-family: Arial, sans-serif; margin: 0; padding: 0; }
        nav { background: #333; padding: 1rem; }
        nav a { color: white; margin-right: 1rem; text-decoration: none; }
        .content { padding: 2rem; }
        footer { background: #333; color: white; text-align: center; padding: 1rem; position: fixed; bottom: 0; width: 100%; }
    </style>
</head>
<body>

<?php
// FILE: includes/nav.php
// Navigation menu
?>
<nav>
    <a href="index.php">Home</a>
    <a href="about.php">About</a>
    <a href="projects.php">Projects</a>
    <a href="contact.php">Contact</a>
</nav>

<?php
// FILE: includes/footer.php
// Common footer
?>
<footer>
    <p>&copy; 2024 John Doe. All rights reserved.</p>
</footer>
</body>
</html>

<?php
// FILE: index.php
// Main portfolio homepage
$pageTitle = 'Home - My Portfolio';
include 'includes/header.php';
include 'includes/nav.php';
?>
<div class="content">
    <h1>Welcome to My Portfolio</h1>
    <p>Hi! I'm John Doe, a web developer passionate about creating amazing digital experiences.</p>
    <p>Explore my site to learn more about my work and get in touch!</p>
</div>
<?php include 'includes/footer.php'; ?>

<?php
// FILE: about.php
// About page
$pageTitle = 'About Me - My Portfolio';
include 'includes/header.php';
include 'includes/nav.php';
?>
<div class="content">
    <h1>About Me</h1>
    <p>I have 5 years of experience in PHP, JavaScript, and database design.</p>
    <p>I love solving complex problems and building scalable web applications.</p>
</div>
<?php include 'includes/footer.php'; ?>
output
A multi-page portfolio website with consistent header, navigation, and footer across all pages (index.php, about.php, projects.php, contact.php). When visiting index.php, displays a welcome message with navigation links that work across pages, demonstrating code reusability through PHP includes with a professional layout featuring a dark navigation bar and fixed footer.