Tag

php array list

Browsing

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

 

In the Given example, we have to find whether  “CSS” Find or not in the array. It prints the key of the value.

Output

b   // output

Explaination

array_search is used to search the array value(‘css’) and returns the value’s key(‘b’);

2. In_array()

In_array is simillar to the array_search

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

you can search anything value or key using IN_ARRAY();

for example

have to find “Developerdesks” in the given array

 

You can see explanation in this url

 

A multidimensional array is an array containing one or more arrays.

Three-Dimensional array

For three dimensional array u have to use two for loop condition
find 0 indexed array value and then 0 indexed array value

Explain

First foreach consider skill as $develop and php =>80 as $desks

Second For each consider $key as php and $ value as 80

so the $develop –> indexed as skill, $key–> indexed as php and $value indexed as 80

simple foreach concept worked

Output

 

Similar like three dimensional array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination

Associative array is array that use named keys that you assign to them.

example

named key ‘raj’ has vlaue ‘123’;

IF the named key is unknown and unlimited the use foreach

output

Similar like Associative array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination

 

How to use for loop concept for php using find array values

for loop is used to initialize the code for how many times it should run.

syntax

for (initialization counter; total counter; increment counter) {
    code to be executed;
}

for example

output

for loop php is used to count and auto increment the array values using loop.

What is Array?

An array is a variable, which can hold more than one value at a time.
php Array basic function defined as
array();

example

For more explanation about array

How to print array values indexing in php using Indexed array

Indexed array is array with a numeric index. Index will Start with ‘0’ and it can be assigned automatically

example

If you know the total number of array values means you can do like this,

For unknown and unlimited array values are present then go to Forloop

Example

To know the array total values use count(); Functions

 2. Count();

This Function is used to fin the count of array key in the array.

3. Associative array()

Associative array is array that use named keys that you assign to them.

example

For more Explanation click here

What is Array? how to use  php array?

An array is a variable, which can hold more than one value at a time.
php array basic function defined as
array();

example

Three Types of Php array

1. Indexed array
2. Assocaiative array
3. Mutlidimentional array

Click Here to know indexed array

PHP Introduction

Before learning php, you should have some knowledge in below topics:

  • HTML
  • CSS
  • JavaScript

Define php?

  • PHP is an acronym for “Hypertext Preprocessor”
  • PHP is a widely-used, open source scripting language
  • PHP scripts are executed on the server
  • PHP costs nothing, it is free to download and use

Php File

  • PHP files can contain text, HTML, CSS, JavaScript, and PHP code
  • PHP code are executed on the server, and the result is returned to the browser as plain HTML
  • PHP files have extension “.php”

Thats basic intro about PHP