PHP Programs: Best PHP Examples, Exercises, and Scripts

PHP is a popular general-purpose, free, widely-used server scripting language that is used to make dynamic and interactive web pages i.e., it is especially suited for web development. PHP was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994.

PHP Examples, Exercises, and Scripts

This section contains the solved PHP programs/examples on various topics such as arrays, strings, class & objects, exception handling, JSON, regular expressing, database connectivity, etc. The best way to learn PHP programming is by practicing examples. Here, you will find the set of PHP examples on the basic & advance concepts of PHP. These PHP programs are helpful to enhance the PHP programming skills of a beginner as well as an experienced programmer. Each program contains the solved code, explanation of the statements/functions used in the program, and output.

PHP Programs Index



PHP Basic Programs

  1. PHP Code to print text using print command
  2. PHP Code to print text using echo command
  3. PHP program to create a function to find the addition of two integer numbers
  4. PHP Code to print current date in various formats
  5. PHP Code to print current time in various formats
  6. More PHP Basic Programs ...

PHP Array Programs

  1. Create an associative array in PHP
  2. How to get the only values from an associative array in PHP?
  3. PHP program to sort an integer array in ascending and descending order
  4. PHP | Delete an element from an array using unset() function
  5. PHP | Delete all occurrences of an element from an array
  6. More PHP Array Programs ...

PHP String Programs

  1. Concatenating two strings in PHP
  2. How to convert array into string in PHP?
  3. Check if string contains a particular character in PHP
  4. How to convert a string to uppercase in PHP?
  5. PHP program to convert string to uppercase without using the library function
  6. More PHP String Programs ...

PHP Class & Object Programs

  1. PHP program to create an object of a class and access the class attributes
  2. PHP program to create multiple objects of a class and access attributes of the class
  3. PHP program to define methods within the class
  4. PHP program to initialize data members without using the constructor
  5. PHP program to print the size of the empty class
  6. More PHP Class & Object Programs ...

PHP Exception Handling Programs

  1. PHP program to demonstrate the Divide By Zero Exception using exception handling
  2. PHP program to demonstrate the Array index out of bound exception using exception handling
  3. PHP program to demonstrate the NULL reference exception using exception handling
  4. PHP program to create a user-defined exception class
  5. PHP program to create DivideByZeroException class
  6. More PHP Exception Handling Programs...

PHP JSON Programs

  1. PHP program to convert an associated array into JSON format
  2. PHP program to demonstrate the json_encode() function with indexed array of strings
  3. PHP program to demonstrate the json_encode() function with multi-dimensional array
  4. More PHP JSON Programs...

PHP Regular Expressions Programs

  1. PHP program to check a substring exists within the given string using a regular expression pattern
  2. PHP program to check a case insensitive substring exists within the given string using regular expression pattern
  3. PHP program to demonstrate the regular expression to count the occurrence of given substring
  4. More PHP Regular Expressions Programs...

PHP Database Programs

PHP File Handling Programs

Miscellaneous




Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.