How to Convert A String To Uppercase in PHP The PHP strtoupper() function is used to convert a string to uppercase. Try the below example to under the working of this function, which convert all alphabets of a string to uppercase. Example:


Read More

Combine Two Strings

How to Combine Two Strings in PHP The PHP programming language uses dot (.) operator to create singe string by combining two strings. This operator is specifically designed for strings. You can use this operation in multiple ways. Example 1:

You can also concatenate one string and other string variable. For example:

You can also concatenate with assignment operator (‘.=’), which appends the argument on the right side to the argument on the left side. For example:

Read More

Get Current Year

How to Get the Current Year using PHP PHP date() function is used for getting date. You can customize the output by passing the values to the function. For example, to get the current year pass “Y” to the function. This will show you the current date only. Use below sample PHP program to print current year.

This is also useful for the printing the copyright statement with the current year at the footer of your website. For example add below state to your php script footer file.

Read More

Docker PHP CLI Example

Run PHP CLI Application with Docker Docker provides official images to run PHP script on command line. These are helpful to run script on shell, scheduled jobs with php script like cron jobs. This tutorial will help you to run a sample php script on CLI using Docker containers. Run PHP CLI on Docker The CLI scripts run on a terminal, these scripts are helpful to background jobs, scheduled jobs with the crontab. The below example, will run a sample php script with CLI on Docker. Create PHP Script –…

Read More

Docker PHP Example

Run PHP Web Application with Docker You can run any PHP application on using web server or command line using Docker containers. This tutorial will help you to run a PHP script over command line with a Docker container. Also, you will find the instructions to run a PHP script over Apache/Nginx web server with Docker. Docker PHP Example with Apache Create PHP Script – First, create a sample PHP script to run on web server under the Docker container. Edit index.php in your favorite text editor. nano index.php Add…

Read More