<form action="" method="get">
What do you do?:
play <input type="checkbox" name="spare_time[]" value="sport">
Not play <input type="checkbox" name="spare_time[]" value="sport">
</form>
buttons
<br/><br/>
Do you play?
Yes<input type="radio" name="plays_lol" value="yes" checked="checked">
No<input type="radio" name="plays_lol" value="No">
<body>
<form action="" method="get">
pick food:
<select name="food" >
<option value="potatuna" > potato </option>
<option value="popcorn" > popcorn </option>
<option value="pizza" > pizza </option>
</select>
</form>
</body>
<body>
<form action="" method="get">
username:<input type="text" name="username" maxlength="10" size="">
password:<input type="password" name="password" maxlength="10" size="">
</form>
</body>
echo substr("Hello world",6);
Using the start parameter with different positive and negative numbers:
// Positive numbers:
echo substr("Hello world",10)."<br>"; //d
echo substr("Hello world",1)."<br>"; //ello world
echo substr("Hello world",3)."<br>"; //lo world
echo substr("Hello world",7)."<br>"; //orld
echo "<br>";
// Negative numbers:
echo substr("Hello world",-1)."<br>"; //d
echo substr("Hello world",-10)."<br>"; //ello world
echo substr("Hello world",-8)."<br>"; //lo world
echo substr("Hello world",-4)."<br>"; //orld
Using the start and length parameters with different positive and negative numbers:
// Positive numbers:
echo substr("Hello world",0,10)."<br>"; //Hello worl
echo substr("Hello world",1,8)."<br>"; //ello wor
echo substr("Hello world",0,5)."<br>"; //Hello
echo substr("Hello world",6,6)."<br>"; //world
echo "<br>";
// Negative numbers:
echo substr("Hello world",0,-1)."<br>"; //Hello worl
echo substr("Hello world",-10,-2)."<br>"; //ello wor
echo substr("Hello world",0,-6)."<br>"; //Hello
<?php
echo strtolower("Hello WORLD.");
?>
<?php
echo strlen("Hello");
?>
`<?php
echo str_replace("world","Peter","Hello world!");
?>
<?php
echo similar_text("Hello World","Hello Peter");
?>
$str = " Hello World! ";
echo "Without trim: " . $str;
echo "<br>";
echo "With trim: " . trim($str);
The HTML output of the code above will be (View Source):
<!DOCTYPE html>
<html>
<body>
Without trim: Hello World!
With trim: Hello World!
</body>
</html>
The browser output of the code above will be:Without trim: Hello World!
With trim: Hello World!
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>