Games numbers PHP

Pyramid of stars in PHP

Write a program to generate pyramid of stars.

This is the most commonly asked question to beginners. Though this seems to be very complex during my school days, but not.

Program to generate/draw pyramid of stars/asterisks in php

echo '<pre>';
$horizontal = 10;
$vertical = 10;
while ($vertical--)
    echo str_repeat(' ', $vertical) . str_repeat('* ', $horizontal - $vertical) . "\n";
echo '</pre>';
'Coz sharing is caring

By Swatantra Kumar

Swatantra is an Open Source evangelist, a technologist and researcher. Professionally, he does software development, software architecture, server administration and project management. When he's not writing software, he enjoys building web entities and servers, reading about and working with new technologies, and trying to get his friends to make the move to open source software. He's written, co-written and published many articles in international journals, on various domains/topics including Open Source, Networks, Computer Organization, Mobile Technologies, and Business Intelligence. He made a proposal for an information management system at University level during graduation days.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.