How to Convert 1000 to 1k |using PHP

Welcome back to shorltearner.com, in our previous post we learn how to Convert words to numbers with the help of PHP. so in this post today we will learn how to convert number into sort number format in PHP.
so before start this tutorial we take an overview on number_format which is also a predefined PHP function that are used to The number_format() function formats a number with grouped thousands.

how to convert number into sort form in php

Also Read :
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

for example if i take the below code as an example

than the number_format function returns an output like

so If we want to convert number into sort form in thousand, million, billion then we used another predefined PHP function number_format_short that will help to convert any number to it’s sort form like (Eg: 1.4K, 14.32M, 40B ) etc.
so in the below code we take an example which converts a number 1,43,20000 into 14.32M.

Upload a file to the Server using|PHP

welcome back to shortlearner.com , in our previous post we learn how to Convert words to numbers in PHP. in this post we will see how to Upload a file to the Server with the help of PHP.
Let’s go through the overview of this program before starting the tutorial. So we will first create a file with the name index.php, in this file we are creating a responsive form by using bootstrap classes and taking a file from user and after submitting the form we will upload it on the server.

Upload a file to the Server

Index.php

Also Read :
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

after submitting the form we will upload this file on the server using below code.

Get YouTube video thumbnail using PHP

welcome back to shortlearner.com , in our previous post we learn how to convert YouTube URL to embed URL PHP.in this post we will see how to Get YouTube video thumbnail and use it with PHP
so in the below code we explode the URL and create a link which will show the thumbnail of individual video id and use it on img tag.

How to get YouTube Video Thumbnail

Also Read :
How to Install PHP on CentOS.
How to integrate Razorpay Payment Gateway using PHP.

Get Domain name from URL
Unable to create a directory a wordpress error
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

Convert a youtube video url to embed code

welcome back to shortlearner.com , in our previous post we learn how to Convert words to numbers in PHP. in this post we will see how to Convert a youtube video url to embed code with the help of PHP.
so in the below code we create a PHP function convertYoutube and pass YouTube link as a parameter, the convertYoutube function is converts our URL into embed code.

convert youtube url to embed url php

Also Read :
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

generate an array with a range using PHP

Welcome back to shorltearner.com, we are starting a new series of PHP interview questions for beginners and experienced,so in previous post we learn, Converting words to numbers in PHP
In this post we see how to generate an array with a range taken from a string.

How to generate an array of strings numbers with a specific range

Also Read
Unable to create a directory a wordpress error
PHP program that multiplies corresponding elements of two given lists
PHP program to print out the multiplication table up to 6*6
Write a PHP program to check if the bits of the two given positions of a number are same or not

Output

another way to find range between to given numbers with the help of php predefined function range(), see the below example

Output