Many times you might want to check if some variable has been set and it holds a non-falsy value.
With PHP loose typing:
if (isset($variable) && !empty($variable)) {
// ...
<?php | |
$headers = get_headers('http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=nonexistingid'); | |
if (!strpos($headers[0], '200')) { | |
echo "The YouTube video you entered does not exist"; | |
} |
<?php | |
// this file is inside src folder | |
namespace PHPWorldWide; | |
use PHPMailer; | |
class Mailer | |
{ |
<form method="post" enctype="multipart/form-data" action="upload.php"> | |
File: <input type="file" name="file"> | |
<input type="submit"> | |
</form> |
<?php | |
function getDiff($start, $end) | |
{ | |
$start = explode(':', $start); | |
$end = explode(':', $end); | |
$start = new DateInterval('PT'.$start[0].'H'.$start[1].'M'.$start[2].'S'); | |
$end = new DateInterval('PT'.$end[0].'H'.$end[1].'M'.$end[2].'S'); |
# https://editorconfig.org/ | |
root = true | |
[*] | |
trim_trailing_whitespace = true | |
insert_final_newline = true | |
indent_style = space | |
end_of_line = lf | |
indent_size = 4 |
Habits tracking is a simple and powerful way to track your daily habits to either improve something in your life or to break some destructive habit.
Templates are available for download in different sizes: