Write a program to find the factorial of a number. Factorial of a number is the product of numbers from 1 to ‘n’. Eg:- 5! = 1*2*3*4*5 = 120 PHP :- Declare the number to $n Set $product as 1 In a for loop, loop through 1 to $n Inside the for loop, multiply $i […]
Create folder using php
How to create folder using php. Use mkdir() function to create new folder using php. We can also specify the full path to create folder as follows, Here 0777 is specified to give the permission. Click here to check more about file permissions. For more php related queries check this link
Create CSV file with php
How to create csv file with php? Generating csv file with php and download it. In this article we will discuss about how to create CSV file with php. Rather than creating csv file we will also download the same. This is achieved by the help of fputcsv() function. It formats a line as csv […]
Sending Emails using PHP
Sending emails using php can be done by the mail() function. If you are looking for codeigniter mail function please click here. In this article we will discuss sending emails using php. It can be done by the php mail() function. The mail() function requires three mandatory parameters: to address, subject of mail and the […]
PHP form submit on same page
How to do PHP form submit on same page. On submitting the form stay on same page. In this article we’ll discuss php form submit on same page. There are two ways to submit a form using php, either on the same page or to a php script. To submit a form on the same […]
Upload Base64 image PHP
How to upload base64 image php? Uploading base64 encoded image in php. In this article we will discuss about how to upload a base64 encoded image in php by specifying the url. If you want to upload an image from url checkout this link upload image from url. HTML : Create a form with method […]
Remove html tags from string using php
How to remove html tags from string using php? We can remove html tags from string by using strip_tags() in php. The strip_tags() function strips a string from HTML, XML, and PHP tags. Syntax : strip_tags(string,allow) The first parameter string is mandatory and it specifies input string which we want to strip. The second parameter […]
Highlight and Compare strings with differences and similarities in php
How to compare strings with differences and similarties in php ? In this article we’ll discusshow to compare strings with differences and similarities in php. Usually we can use strcmp() to compare strings but it returns binary as result. Here we want to show the differences and similarities. This is a simple method to compare […]
Compress and upload Image using PHP
How to compress and upload image using Php? Uploading large sized files will always take more time and also it will occupy more disk space. To solve this issue better option is reducing the image size and then upload it. Go through the tutorial for compress and upload image using php. HTML : Declare a […]
Check if a date is today, yesterday or tomorrow
How to check a given date is today, yesterday or tomorrow, or how many days far,etc using php ? Sometime we may have to find a given date is today, yesterday or tomorrow, or how many days far,etc. In this tutorial we’ll discuss how to find the given date is today yesterday or tomorrow,etc. To […]