Image

PHP/MySQL / Code (page 3)

BEGINNER

C 0017 - FOR LOOP
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php  
for ($x = 0; $x <= 200; $x+=40) {
  echo "Result: $x <br><br>";
}
?>  
</body>
</html>
C 0018 - FOR LOOP
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php  
for ($x = 0; $x <= 800; $x+=10) {
  echo "Result: $x <br><br><br>";
}
?>  
</body>
</html>
C 0019 - FOR LOOP
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php
echo str_word_count("My planet is so far away !");
?> 
</body>
</html>
C 0020 - Basic form

Reproduce this code (do not copy and paste!). But you can't test it in a compiler !

<!DOCTYPE HTML>
<html>  
<body>
<form action="treatment.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
C 0021 - RegEX (preg_match_all())
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php
$str = "Simon is walking by the river.";
$pattern = "/sim/i";
echo preg_match_all($pattern, $str);
?>
</body>
</html>
C 0022 - RegEX (preg_match_all())
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php
$str = "Simon is walking by the river.";
$pattern = "/lulu/i";
echo preg_match_all($pattern, $str);
?>
</body>
</html>
C 0023 - RegEX (preg_match_all())
Reproduce this code (do not copy and paste!).

<!DOCTYPE html>
<html>
<body>
<?php
$str = "Try to catch me !";
$pattern = "/catch/i";
echo preg_match_all($pattern, $str);
?>
</body>
</html>
Image

CHOOSE YOUR COMPILER

Reproduce this code, choosing one of the compilers below (don't copy and paste! It would be too easy). They all have the same function, just choose one according to your preferences.

When copying your code, replace the existing (default) code already in the compiler with your own.

Warning ! Choose the compiler based on the formatting (e.g., with or without HTML tags). For some of these compilers, you must choose the programming language yourself from the menu that is then offered. Of course, don't forget to click on RUN !

Responsibility

Some of the external links presented below, are not under the direct responsibility of Fond of Code. We cannot therefore be held responsible for the quality/Viability, or the temporary nor permanent interruption of some of them.

All about PHP

Code

Recent versions

Frameworks

Tools/Methodologies

Test

Info+

» Creation date: 1994
* Created by Rasmus Lerdorf
* Developed by The PHP Group
* Influenced by C/C ++, Java and PERL
* Written in C

* Cross-platform
* Free license / PHP license

News

The comments you leave us are systematically subject to rigorous moderation. Incivility and slander, threats, intimidation of all kinds, more generally all gratuitous verbal violence, or the dissemination of unverified information... are not tolerated. We also reserve the right to publish only comments which effectively advance the debate and allow a better understanding of the subject covered by the article presented on this page (as well as all its ramifications) and this, whatever its overall content.

Image

Fond of Code TM © ®
All rights reserved - Protected Trademark/Logo (INPI)

Legal structures based in
Nice - FRANCE

Montreal - Canada
By appointment

SIRET: 41138921600028 (France)
Inc. : 661515-5 (Canada, Qc.)
Official resumption in France : March 2025
Beta version of the website : May 2024
Implementation : July 2024
Launch of initial activity : 1996 (Europe and North America)
New version of the website : April 2025

Fond of Code official launch : May 2025

Image
Image