• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / PHP / Using strtolower() in php to Convert String to Lowercase

Using strtolower() in php to Convert String to Lowercase

March 22, 2022 Leave a Comment

In php, we can make all characters in a string lowercase easily with the php strtolower() function.

$variable = "THIS IS A STRING VARIABLE";

echo strtolower($variable);

//Output:
this is a string variable

When working with string variables in our php programs, it is useful to be able to easily manipulate and change the value of the variables. One such change is if you want to make a string lowercase.

To make all characters in a string lowercase in php, we can use the php strtolower() function.

strtolower() takes in a string and converts all characters to lowercase.

Below is a simple example of how to use the strtolower() function in php to convert a string to lowercase.

$variable = "THIS IS A STRING VARIABLE";

echo strtolower($variable);

//Output:
this is a string variable

Make String Uppercase in php with strtoupper()

We can also make a string uppercase easily in php. The strtoupper() function takes in a string and makes all of the characters uppercase.

Below is an example of how to convert a string uppercase in php with strtoupper()

$variable = "this is a string variable";

echo strtoupper($variable);

//Output:
THIS IS A STRING VARIABLE

Hopefully this article has been useful for you to learn how to make a string lowercase in php.

Other Articles You'll Also Like:

  • 1.  Get Days in Month Using php
  • 2.  php array_slice() – Get Slice of Elements from Array
  • 3.  php floor – Round Down and Find the Floor of a Number in php
  • 4.  php var_dump() Function – Print Information about Variable Type and Value
  • 5.  php tan – Find Tangent of Number in Radians Using php tan() Function
  • 6.  php array_diff() – Find Elements of Array Not Present in Other Arrays
  • 7.  php e – Using M_E and exp() Function to Get Euler’s Constant e
  • 8.  Remove HTML Tags from String in php
  • 9.  In PHP isset Method is Used For Checking if Variable is Defined
  • 10.  php Trig – Using Trigonometric Functions in php for Trigonometry

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy