Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to print a star pattern in PHP embedded in HTML? -6

How to print a star pattern in PHP?

What is star pattern?

Star Pattern is the series of such character like (*) or another characters can be used to print to create geometrical shapes.

Logic:

  1. Input number of rows(i) to print from user given $num.
  2. To iterate through rows(i) run an outer loop from 0 to $num with for loop.
  3. To iterate through columns(j) run an inner loop form 1 to $i with for loop.
  4. After printing all columns(j) of a row move to next line.

Right Triangle Star Pattern coding:

Entering a number:

Input number is 6
Output of 6

Thanks

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.