Library contents

PHP strtolower

Normalize an ASCII course tag to lowercase before grouping records.

A simple example

strtolower

  1. Start with "AB"
  2. Do this Convert to lowercase
  3. Result "ab"
Each uppercase ASCII letter has a lowercase counterpart.
lesson.php
<?php
$value = "AB";
echo (strtolower($value)), PHP_EOL;
Output
ab

Syntax

PHP syntax
strtolower($value)
Run these examples in PHP

Save one example at a time as lesson.php. Use PHP 8.2 or later.

php lesson.php

Normalize a course tag

A course catalog accepts short tags from several editors. Bring a new tag into the chosen case convention before using it in the public listing.

From the program$value = "BIO-101"
Resultbio-101
lesson.php
<?php
$value = "BIO-101";
echo (strtolower($value)), PHP_EOL;
Output
bio-101

Digits and the hyphen stay unchanged.

Advertisements

Normalize a receipt status

Two terminals can enter the same short label with different capitalization or padding. Normalize the incoming spelling before lookup so the stored identifiers can follow a consistent convention.

From the program$value = "PAID"
Resultpaid
lesson.php
<?php
$value = "PAID";
echo (strtolower($value)), PHP_EOL;
Output
paid

The same status can be compared consistently in this ASCII data set.

Read a parcel sorting code

The depot scans a parcel marked NC-17. The search index stores the complete identifier in lowercase. Which key goes into the index?

GivenNC-17
Worked resultnc-17

What to watch for

Keep the original spelling for display names. Machine tags here use only ASCII letters and digits.

Documentation for strtolower