About 4,650,000 results
Open links in new tab
  1. php - Using loop to create a shape - Stack Overflow

    Nov 3, 2018 · There are many possible ways to achieve this when I started programming I never cared about the code quality and just focused on the output. I have added two examples to …

  2. PHP Nested for loop - pyramid shape - Stack Overflow

    Sep 17, 2015 · You can replace the sub loops with str_repeat(), and use the substr() to trim the last part. for ( $row = 8; $row >= 0; $row-- ) { echo substr( str_repeat( " - ", $row ) . str_repeat( …

  3. PHP for loops - W3Schools

    The PHP for Loop. The for loop is used when you know how many times the script should run. Syntax for (expression1, expression2, expression3) { // code block} This is how it works: …

  4. PHP Program to Print Pyramid Patterns - W3Schools

    This tutorial demonstrates a simple PHP implementation for printing design patterns. Pattern programs help beginners understand how loops work and make learning easier by practicing …

  5. PHP Program to Print Diamond Shape Star Pattern

    Jan 17, 2024 · Printing a diamond-shaped star pattern is a classic programming exercise that involves nested loops to control the structure of the pattern. In this article, we will explore …

  6. web - I want to print triangle in stars pattern in PHP can anyone …

    Feb 21, 2017 · You need to add spaces/padding around the * so the triangle forms. This will work, still uses two for loops: $spaces = ""; for($b = (5 - $a); $b>1; $b--) $spaces .= " "; echo …

  7. PHP Star Triangle Program - Tpoint Tech - Java

    Mar 10, 2025 · The star triangle in PHP is made using for and foreach loop. There are a lot of star patterns. We'll show some of them here. Pattern 1 Example <?php f...

  8. Write a php program to draw a rectangle using for loop

    Dec 24, 2020 · Write a php program to draw a rectangle using for loop. There are you will learn how to draw a rectangle using for loop. for ($i = 1; $i <= $r; $i++) { for ($j = 1; $j <= $c; $j++) { …

  9. PHP Loops - GeeksforGeeks

    Apr 10, 2025 · PHP for loop is used when you know exactly how many times you want to iterate through a block of code. It consists of three expressions: Initialization: Sets the initial value of …

  10. PHP for loop - Exercises, Practice, Solution - w3resource

    Dec 20, 2024 · Write a PHP program which iterates the integers from 1 to 50. For multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz".

  11. Some results have been removed
Refresh