Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Get the same values from two or more arrays in PHP

 

How to get the same values from two or more arrays in PHP


The array_intersect() function compares the values of two (or more) arrays, and returns the matches.

Syntax

array_intersect(array1,array2,array3,…);

Example
<?php
$array1 = array(‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’);
$array2 = array(‘c’,’d’,’o’,’l’,’p’,’i’,’u’,’y’);
$array3 = array_intersect($array1, $array2);
print_r($array3);
?>

This function compares the values of two or more arrays, and return an array that contains the entries from array1 that are present in array2.

PHP Tutorial for Beginners


Summary

The PHP Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP. PHP is the most popular scripting language on the web. This tutorial helps you to build your base with PHP. This tutorial is designed for PHP programmers who are completely unaware of PHP concepts but they have basic understanding on computer programming.

What Do I Need?

To start using PHP, you can:
Install a web server on your own PC, and then install PHP and MySQL.

Set Up PHP on Your Own PC

The official PHP website (PHP.net) has installation instructions for PHP

What is XAMPP?

XAMPP is an open-source cross-platform web server, MySQL database engine, and PHP and Perl package. It is compiled and maintained by apache.
The acronym XAMPP stands for;

  • X : [cross platform operating systems] meaning it can run on any OS Mac OX, Windows , Linux, etc.
  • A: Apache – this is the web server software.
  • M: MySQL – Database.
  • P: PHP
  • P: Perl – scripting language

How to Download and Install XAMPP?

We look into step by step process to install XAMPP for Windows. For Other Operating Systems, installation steps are similar.

  • Download the XAMPP installer.
  • Installation XAMPP is just like installing any other windows program.
  • In the succeeding screen, click the next button.

  • On the next screen, change the installation path if required. Click the Next button.

  • In the next screen select Apache and MySQL. You may optionally select FileZilla (FTP Client) if needed. Click the Install button.

  • On successful completion of the installation, you will see the following window

  • Click on the Finish button
  • XAMPP Control Panel

    The control panel is used to manage programs installed via XAMPP. To open the XAMPP control panel. Explore the C directory and locate XAMPP.

    C:\xampp\xampp-control.exe

  • The diagram below shows the control panel.

Post a Comment

0 Comments