Print Alphabet Pattern in PHP

Advertisements

Prev Tutorial Next Tutorial

Print Alphabet Pattern in PHP

For print this type of pattern you need to follow same concept of c programming only change syntax.

Print Alphabet Pattern in PHP

<?php

$ascii_val = ord("a");
for($i=$ascii_val;$i<$ascii_val+26;$i++)
{
echo chr($i)."  ";
}

?>

Output

	
a b c d e f g h i j k l m n o p q r s t u v w x y z

Print Alphabet Pattern in PHP

<?php

$ascii_val = ord("a");
for($i=$ascii_val;$i<$ascii_val+26;$i++)
{
echo chr($i)."</br>";
}

?>

Output

	
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

Print Alphabet Pattern in PHP

<?php

$alphas = range('A', 'Z');
foreach($alphas as $value)
{
    echo $value."<br>";
}

?>

Output

	
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z

Print Alphabet Pattern in PHP

<?php

$letters = range('A', 'Z');
for($i=0; $i<5; $i++)
{ 
  for($j=5; $j>$i; $j--)
{
    echo $letters[$i];
    }
    echo "<br>";
}

?>

Output

	
AAAAA
BBBB
CCC
DD
E

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements