Found 38 Questions For PHP

How to echo HTML in PHP ?

Updated on 29-Jan-2023 13:18:02
While making a web application with PHP, we often need to print or echo few results in form of HTML. We can do this task in many different ways. Some of methods are described here:1. Using echo or print: PHP echo or print can be used to display HTML markup, javascript, text or variables.Example 1: This example uses PHP echo to display the result.<?php     $name = "Codegyan";    echo "<h1>Hello User, </h1> <p>Welcome to {$name}</p>";?>Output:... Read Mores

PHP Date and Time Function

Updated on 26-Jan-2023 14:42:35
In this tutorial, we will see how to get the date & time using the date() & time() function in PHP, we will also see the various formatting options available with these functions & understand their implementation through the examples.Date and time are some of the most frequently used operations in PHP while executing SQL queries or designing a website etc. PHP serves us with predefined functions for these tasks. Some of the predefined functions in PHP for date and time are discussed ... Read Mores

What does ‘<?=’ Short Open Tag Mean in PHP ?

Updated on 29-Mar-2024 0:08:15
PHP, a powerful server-side scripting language, offers various features to enhance developer productivity. One of these features is the ‘<?=’ short open tag, which provides a convenient shorthand for echoing variables and expressions. In this comprehensive guide, we will delve into the meaning, syntax, usage, and best practices surrounding the ‘<?=’ short open tag in PHP. What is the ‘<?=’ Short Open Tag? The ‘<?=’ short open tag is a concise syntax in PHP used to o... Read Mores

Write PHP Program To Print Sum Of Digits

Updated on 11-Mar-2024 10:56:23
PHP Program To Print Sum Of Digits: The below program gives the sum of two variables x and y. The PHP echo statement is used to output the text and sum value to the screen. In a similar way, codes can be written to get a sum of multiple variables in PHP. Example <?php $txt1 = "Sum of x and y is:"; $x = 1234; $y = 4321; echo "<h3>" . $txt1 . "</h3>"; echo $x + $y; ?> Output Sum of x and y is: 5555... Read Mores

Write PHP Program To Check Prime Number

Updated on 16-Mar-2022 8:40:06
PHP Program To Check Prime Number : The below program checks if a number is a prime or a composite number. The PHP echo statement is used to output the result on the screen. Example <!DOCTYPE html> <html> <body>   <?php $num = 13; $count=0; for ( $i=1; $i<=$num; $i++){ if (($num%$i)==0){ $count++; } } if ($count<3){ echo "$num is a prime number."; } else{ echo "$num is not a pri... Read Mores

Download YouTube Video Thumbnail in PHP & JavaScript

Updated on 11-Jan-2022 1:02:44
Hey Everyone, today in this tutorial you’ll learn how to Save or Download YouTube Video Thumbnail or other Image Files using PHP cURL & JavaScript. In the earlier tutorial, I have shared a blog on Popup Share Modal UI Design using HTML CSS & JavaScript and now it’s time to create a project to download YouTube video thumbnail using JavaScript & PHP. In this YouTube Video Thumbnail Downloader, you can see in the image preview a white box or form with an input field, image preview... Read Mores

How To Clean Up Unnecessary Code From WordPress Header Without Plugins

Updated on 28-Oct-2021 9:44:44
How To Clean Up Unnecessary Code From WordPress Header Without Plugins How To Remove Weblog Client Link Example: <link rel="EditURI" type="application/rsd+xml" title="RSD" href="" /> To remove the EditURI/RSD link from WordPress header, paste the below code into your theme’s function.php. remove_action ('wp_head', 'rsd_link'); How To Remove Windows Live Writer Manifest Link Example: <link rel="wlwmanifest" type="application/wlw... Read Mores

How to Install PHP 8 on Ubuntu 20.04

Updated on 27-Oct-2021 5:27:23
PHP is arguably one of the most widely used server-side programming languages. It’s the language of choice when developing dynamic and responsive websites. In fact, popular CM platforms such as WordPress, Drupal, and Magento are based on PHP. Some other notable benefits of using PHP include the following: Easy to learn; the syntax is simple and well organized. PHP code can easily be edited at any time without messing up the entire code; this flexibility is very important for scripting ... Read Mores