PERL String Increment Feature - PHP

Description

Increment a non- numeric string in PHP .
Increasing the letter until you reach the next letter .
Example : $y = "a" ; $y++; // $y = "b"

Example 1 :


<?php

$y = "a" ;
for ($z = 0 ; $z <= 10; $z++) 
{
print ($y); 
$y++;
}

?>

    

Output 1 :


abcdefghijk
    

Example 2 :


<?php

$y = "A0" ;
for ($z = 0 ; $z <= 10; $z++) 
{
print ($y); 
$y++;
}

?>

Output 2 :


A0A1A2A3A4A5A6A7A8A9B0

Example 3 :


<?php

$y = "a01" ;
for ($z = 0 ; $z <= 10; $z++) 
{
print ($y); 
$y++;
}

?>

Output 3 :


a01a02a03a04a05a06a07a08a09a10a11

Related tutorial :

How to create an Excel Spreadsheet - PHP

Previous : Pre- and Post- Increment Operator ( ++ ) - PHP …

Next : $_SERVER - PHP ( request uri - query string ) …

^