
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
PHP program to print continuous character pattern triangle
To print continuous character pattern triangle in PHP, the code is as follows −
Example
<?php function continuous_alphabets($val) { $num = 65; for ($m = 0; $m < $val; $m++) { for ($n = 0; $n <= $m; $n++ ) { $ch = chr($num); echo $ch." "; $num = $num + 1; } echo "
"; } } $val = 6; continuous_alphabets($val); ?>
Output
A B C D E F G H I J K L M N O P Q R S T U
This is similar to generating a star or a number pattern, the only difference being, continuous characters of English alphabets are generated instead of stars or numbers. The function ‘continuous_alphabets’ is defined that takes the limit as a parameter. The limit value is iterated over and the character is printed and relevant line breaks are also generated in between. The function is called by passing this limit value and the relevant output is generated on the console.
- Related Articles
- PHP program to print continuous numbers in the form of triangle
- PHP program to print the number pattern
- Java Program to Print Upper Star Triangle Pattern
- Java Program to Print Downward Triangle Star Pattern
- Java Program to Print Left Triangle Star Pattern
- Swift program to Print Upper Star Triangle Pattern
- Swift Program to Print Downward Triangle Star Pattern
- Swift Program to Print Left Triangle Star Pattern
- Swift program to Print Upper Numeric Triangle Pattern
- Golang Program to Print Left Triangle Star Pattern
- Golang Program to Print Right Triangle Star Pattern
- Golang Program To Print Downward Triangle Star Pattern
- Swift Program to Print Alphabetic Right Triangle Pattern
- Swift Program to Print Binary Right Triangle Pattern
- Swift Program to Print Upper Binary Triangle Pattern

Advertisements