PHP Programs

Here, at phptpoint we begin from the scratch where we can lead you on the practice of these languages.

This is a free and online site where the students who want to build a career in the same profession, can be trained about the working of the PHP.

The following are the most important PHP programs that are frequently asked in interviews. These programs cover PHP fundamentals, PHP control statements, PHP arrays, PHP strings, PHP oops, PHP file handling, and so on.

Even Odd Program

A program to check 1233456 is odd or even is shown.


  1. <?php
  2. $number=1233456;
  3. if($number%2==0)
  4. {
  5. echo “$number is Even Number”;
  6. }
  7. else
  8. {
  9. echo “$number is Odd Number”;
  10. }
  11. ?>


Alphabet Triangle using PHP method

Some different alphabet triangle patterns using range() function in PHP are shown below.

  1. <?php
  2. $alpha = range(‘A’, ‘Z’);
  3. for($i=0; $i<5; $i++){
  4. for($j=5; $j>$i; $j — ){
  5. echo $alpha[$i];
  6. }
  7. echo “<br>”;
  8. }
  9. ?>


Star Triangle

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

  1. <?php
  2. for($i=0;$i<=5;$i++){
  3. for($j=5-$i;$j>=1;$j — ){
  4. echo “* “;
  5. }
  6. echo “<br>”;
  7. }
  8. ?>





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

zarray: a dynamic expression system based on xtensor

Have a good summer day, dear friends!

Unity Dev Blog

L3 Atom MVP V2

How I went from die hard Mac OS for my development, back to Windows 10

SCSS: Harnessing @for and @each to build reusable components

Kogito Tooling 0.6.0 Dev Preview 2 Release

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
sanjeev kumar

sanjeev kumar

More from Medium

Laravel Eloquent relationships have a bunch of “with” methods you might not know about.

Laravel 9

Laravel migration — basic