PHP 7.x — P2: Comments

Dino Cajic
Jun 13 · 3 min read
Image for post
Image for post
<?php
// This is a comment inside PHP
This will throw an error
?>
<?php
# This is a single line comment
# This is another single line comment
# $x should be named $title
$x = "Mr";
?>
<?php
/** Comment */
/**
Multi-line comment
This is also part of the comment
$x = "Hey"; <- Still a comment
*/
?>
<?php
$x = "Mr"; // $x should be named $title
$y = "Dino"; # $y should be named $first_name
$z = "Cajic"; /** $z should be named $last_name */
?>
<?php
$x = "Frank";/**
for ( $i = 0; $i < 10; $i++ ) {
echo $x . "_" . $i;
}
*/
?>
<?php
$x = "Frank";for ( $i = 0; $i < 10; $i++ ) {
echo $x . /** "_" . $i*/;
}?>
/**
* This is a multi-line comment.
*
* Author: Dino Cajic
* Copyright Year: 2020
*
* No. This code is not copyrighted.
*/


Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Sign up for Best Stories

By Dev Genius

The best stories sent monthly to your email. Take a look

Create a free Medium account to get Best Stories in your inbox.

Dino Cajic

Written by

Author of An Illustrative Introduction to Algorithms. A Software Engineer with a B.S. in Computer Science, a minor in Biology, and a passion for learning.

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Dino Cajic

Written by

Author of An Illustrative Introduction to Algorithms. A Software Engineer with a B.S. in Computer Science, a minor in Biology, and a passion for learning.

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store