create array in php

Solutions on MaxInterview for create array in php by the best coders in the world

showing results for - "create array in php"
Tiago
22 Oct 2016
1$array = array(
2    "foo" => "bar",
3    "bar" => "foo",
4);
Alexander
06 Sep 2017
1
2<?php
3$array array(
4    "foo" => "bar",
5    "bar" => "foo",
6);
7
8// as of PHP 5.4
9$array = [
10    "foo" => "bar",
11    "bar" => "foo",
12];
13?>
14
15
Shaina
22 Apr 2018
1#Arrays
2
3<?php
4    #array is a variable that holds multiple values
5    /*
6    Three types of arrays
7        - Indexed
8        - associative
9        - Multi-dimensional
10    */
11    // Indexed array is the most common and easiest
12    $people = array('Kevin', 'Jeremy ', 'Sara');
13    $ids = array(23, 55, 12);
14    $cars = ['Honda', ' Toyota', 'Ford'];  // also an array
15    //add to an array
16    $cars[3] = ' Audi';
17    // you can use empty brackets and it will be added to the last one
18    $cars[] = ' Chevy';
19
20    echo $people[1];
21    echo $ids[1];
22    echo $cars[1];    
23    echo $cars[3];
24    echo $cars[4];
25    echo count($cars);
26    //you can also print the entire array
27    print_r($cars);
28    //to look at data type
29    echo var_dump($cars);
30
31    //Associative Arrays key pairs
32    $people1 = array('Kevin' => 35, 'Jeremy' => 23, 'Sara' => 19);
33    $ids1 = array(23 => 'Kevin', 55 => 'Jeremy', 12 => 'Sara');
34    echo $people1['Kevin'];
35    echo $ids1[23];
36    //add to these types of arrays
37    $people1['Jill'] = 44;
38    echo $people1['Jill'];
39    print_r($people1);
40    var_dump($people1);
41
42    //Multi-Dimensional Arrays aka an array within an array
43 
44    $cars2 = array(
45        array('Honda',20,10),
46        array('Toyota',30,20),
47        array('Ford',23,12)
48    );
49
50    echo $cars2[1][0];
51
52    
53?>
Oskar
20 Jun 2019
1$array = array(
2    "foo" => "bar",
3    "bar" => "foo",
4);
5
Alma
23 Aug 2018
1$my_array = array();
Isabelle
15 Nov 2017
1<?php
2$array = array(
3    "foo" => "bar",
4    "bar" => "foo",
5);
6
7// as of PHP 5.4
8$array = [
9    "foo" => "bar",
10    "bar" => "foo",
11];
12?>
13
queries leading to this page
how to name arrays i phpphp array functionread arry phparray example in phpassociative array type phparay phpset element at index 8 to 2 in phparray numbers phpnew item in php arraywhich of the following is the correct way to create an array in phpdeclaring an array phpphp declare array variablephp array indexbasic php array is not an associative arrayaccess array in phpmatrix phparra in phparray declare in phpphp array in one argumentphp types of arraysarray 5b0 5d phpworking with arrays in phpphp array old stylephp array variablephp ardeclare array php array phpphp make var arrayhow to create an array in phparray 5bi 5d phpcreate an array variable phpphp array 3etypes of arrays in phpphp array newphp arrays w3array 2b array phpwhat is linear array in phpnew array 28 29 in phpw3schools php array with colorsarray phpphp array valuesphp create an arrayarray php declarephp 22 3d 3e 22how array is declared in php 3fphp array examplefunction to show array indexes in phpphp how to create arrauphp array of arrayshow to set array phphow to define a new array in phpmake a array in phpphp array new array elementthree different kinds of arrays in phparray in php examplearray variables phpsingle array print in phpdefine an array in phpphp get array how php arrays workphp use variable as array indexdefine array in phpphp assign index to arrayhow to make an subarray phphow to create php array 5b 5dmeaning of 5b 5d and 7b 7d in array phpphp types of arrayphp making arrayhow to declare an array in phpaccess array elements in phpphp array createarray create phphow make to array new in phphow to use an array phpwhat is php arrayworking with arrays phptake array in varaiable phpname an array in phparr 3d array 28 29 phpphp declare an arrayphp creating arryaphp build array of arraysdefine new array phphow to get data from array in phpphp array with 5b 5dhow to declare a matrix in phphow to build an array in phpexample php arraysaccssing array phphow to create aaray in phpphp accesing arrow elements with key issuephp variable arraydeclaire array in phparray of arrays in phparray 28 29 phpdeclaration of array in phpphp array inarrays php w3schoolsgenerate array in phpphp declare array typenew array 28 29 phparray 28 24variable 29php new arrayassociative arry phpphp array create arraycreate array of aaray in php exampledeclaring and array in phpdefine new array in phparray variable phparray in php with examplea php array with string indexes is called a 28n 29 array build an array in phpphp array definephp array 5b 5dvariable arrays phparray php phpphp array from arrayhow do you declare an array in php 3fphp array 5b0 5darray assigning in phpphp initial arrayphp create arraayphp arrazphp declare new arryarrays w3schools phpphp syntax to create arraycreate an array in phpindexed arrays phpphp array samplewhat is setarray in phpaccessing an array in phpphp array itemsdeclare array variable in phpphp is assigining values to an arrayphp arrays libraryphp array 28 29php assign a value or default using an array indexarray values in phpfor array phpecho 24fruits 5b 3a 5d phparray in phhphow to store array into array in phpmake array phphow does array works in phphow create array phpphp create array with item and valuearray declaration in phpcreate custom array in phpdefine php arrayphp array indicesarray syntax in phpdelare array name htmlcreate an array phpphp 2b array 5b 5d 5b 5dw3 school php arraysyntax for writing php arraysaccess php arrayphp arrarphp associative array with numbersphp qarrayhow to read array in phpnew array phpbest way to declare array in php 28array 29 phpphp 3 types of arrayshow do do array in php 5b1 2c2 2c3 5d phpto array phpphp make array of x elements by adding constant valueelements in array phparrays in php with examplearray array array phpbuilding array php 5b 1 5d array phpcreating array of arrays in phpmake string index in array phparray php key and valwrite array php in codearray in 7b 7d phpphp access array membersccreate array phpin which version of php array was introduceddeclare an array in phpcreate a array phparray in php functionhow to use a variable in an array phphphp create simple arrayarray types in phparray creation phpphp array variable in stringcreate a standard array in phpcreate array in phparra 28 29 php 3d 3e array phpnew array declare phpget like elements from array phpphp creating arrayphp create array of arraysnew php creating new arraydeclare integer array phpphp arayphp variables as fields in arrayarray on phpphp arraycreating an array phphow to define arrays in phpphp create array based on valuephp echo array non associativeaccess array element phpcreate array of array data php array in phpphp array 28x 2cy 29decalre array in phphow to store all values from an array in phpphp 28array 29php set of arratphp array number single dimensional array in phpfunction creat array pohphow can you declare the array in php 3f explain with examplephp array strijg index 1 to 5php load arrayarray php w3schoolphp get arrayphp array itemphp access an arrayassgin values in array phpcreate array php array phparray define in phparray value phpphp receive a array or variablehow to define array phpphp how to arrayarray of strings in phparray in new array in phpphp 7 arrayhow to assign values in php arraywriting arrays in phpcreate array list in phpphp array 28 29 or 5b 5ddeclare an arrayphpphp create simple array and print value at indexdefining key value array in phpphp array of numbersdeclare new array phpmultifunction array phparray with 28 29 in phpmake array in phpnew array in phpphp create arratdifferent ways to declare an array in phpdefining array in phpassign new content for an array phparray 5b0 2c 22 22 5d phparrays functions in phpdeclare array in phpnew array string phpwhat is an array in phpphp array with namesphp define array of arrayscreate array php 5dphp create an array of arraysdictionary in phparrys in phphow to define php arrayarray or 5b 5d to declare aray in phparray in php with examplesphp create array with datagive cue component php arrayphp create array of variablesarrays phpphp string arraygenerate array from variables phpphp declare variable as array of intwrite array in phparray of arrays phpa correct way to create an array in php 3f create any aray phpcreate marray phpphp creat arrayarrays phpsave data on array index in phphow declare array in php 7declare array phphhow to use php arraycreate a php arrayhow to declare array variable in phpdataarray phpcreate array in array item phpphp define array with type how to create the array in phpw3c php arraysvariable array phpphp arrayphp define an arrayget arraydeclaring a array in phparray function in php to createcreate array with the values of array phpphp array 2b arrayuse php arrayphp create array 2 valuephp create array with elementsphp building an arraywww what is the use of array in phpphp set values to an array in htmlparsing arrays inside of a key phpphp arrrayphp 22array 7b 7d 22demo array phpas array phpphp multidimensional array not numberedphp create an array of elementsarray 28 29 in phphow to make and array in phpphp araysphp 3e arrayall array examples in phpphp arryhow to make a variable an array in phpphp key value arrayphp array valuesphp in array examplearray how to make phphow to declare array in phparr phpphp make array value as arrayphp arrays of arraysphp array in array point 3d array 28 29 phparray in php make sure array in javascriptphp array php array tutorialhow to strore an array value to variable in php 2b 3d array php 24array in pphphp how to create array manualhow to define array in phpphp array 22 22 22arrray recreate phparry in phpcreate a basic array with phpmake elements array phparray with numbers phpphp array declarationarrayin phpphp declare new array 26 24array phptype of array in phpcorrect way to create array in phpphp associative array indexdelcre a array phphow to use array in phparray declaration phpdefine new array variable in phpphp array accessphp 7 array indexphp arraysaccess elements in phparrray phpphp do arrays always have number keysarrau in phpwhich of the following are correct ways of creating an array in phparray values in phpphp arraphp set array formatdeclare integer arry phphow to expose array in phpphp assign array elementlaravel array typesphp access arrayphp array 5b1 5dphp create new arrays from arraydefining an array in phpdeclaring an array in phpaccess array phphow to add a defination array in phpread from array phpphp array by idin array in phpmake array from phpphp set into arraydeclare dynamic array in php on a loopphp create new arrayassign array php 24array in phparray em php 24var 3d array 28 29 3b phpstore data in php arrayarrary in phphow can we write arrays in phpphp arreyaccessing the array in phpphp araay 28 29how to declare an array phpwrite array phparray function phpphp array on htmlphp array data typephp dictionary with 5bphp define arrayphp array 21 22in php associative array index can be integer 2fstring 22 2c true 2ffalsephp arrphp array 5b 5d 3d valuecreate array value data in string type phpplace value in right from 40 in array phpphp array kindset array in phpphp array syntaxphp access array data 24array 5b 5d 3d phpphp array 22 22array in phpphp array details tutorialwhat type array in phpsimple array example in phpassociative array php examplestore values in array phpsyntax of array in phpcreate array in array phphow to define a vector in phpsyntax for writing php multiple arrayssyntax array phphow to use array element with variable in php 3d 3e in php arraydid php 1 had arraymake array simple phpcreating an array in phphow to make array in phphow to create php arrayhow to access array value in phpphp arrayhow to work with arrays in phpint array phpphp array examplesphp access array value by keycreatearray phpcreate new array in array phphow to create array in phpphp arrusartive arraytoponimo array phparray index phpmaking an array in phpcreate arrays phpdeclare an arry phpphp array as matrixphp array codeuse array phparray examples phpphp declare array of arraysphp new array with valuesvar array in phphow to make make an arrat in phparray method phpcriar array for phpphp how to create arraydefine new index to array phpphp array index arrayphp array 28php 24arrphp array elementscreate array of array phphow to create array phpplace value from a text in right from 40 in array phparray 2b phparray operation in phphow to access array elements in phparray new variable phpphp this arrayarray 28 5b0 5d 3d 3e 7bbuild an array phparray 5b0 5d in phpun array phparray program w3schoolsphp array looks like a string needs to be an arrayhow to make an array in hphp 7 5b 5d arrayphp new array 28 29php arrays with keysvalue of an array in phpphp araaysphp declare array php array 40array program in phparray php with varphp array arrayphp initialize class associative array with valuesuse name of array and not it 27s values phphow to create arrayy in phparray creation syntax in phpphp defining arrayinitialize matrix ohoarray values phphow to work with array in phparray php w3schoolsphp atrray 24array 5b 5d 3d 24var phpphp create array with variablesdeclare new array in phpphp array getphp read arrayphp array 2 variableshow many way to create array in phpphp access array by keyarray in phparray type phpphp array script in htmlcreate array of arrays phphow to access array element in phpwhat is an array phpcreate new array phpget array content and create new array in phpphp initialize object associative arraysimple array phpphp make arraydata array in phphow declare arr in phpdefine array variable in phpnew value in create array phptype of value of array phpcreating array phpget an array phparray 5b 5d 3d array phpwhen yo use array and 5b 5d in phpphp array 28 29 3d 3ephp array 5b 5darray de arrays phprray phparray associative convert to string performance phpname array inside array phpassign array to value phpdefine array php 28 24arr 29 phpphp value in arraphp create array manuallyphp array typesarray concept in phparray bidimensional phphow to form the array by getting elements from html using phpphp array data call 5clearning 5carrarprogram phpmake an array in phpphp dictionaryphp 7 array multiplecreate php arraycrear array phparay 5b 5d phparray de numeros phpcreate new array in phparrays and its types with example in phparry phptypes of array in phpget array phpnamearrys arrayget data from array in phpcreate and store value in variable by using array phphow to declare array in php with bewhow to make a array phpcreate array value phparra phpwhat is array in phphow to create new array in phpphp create array 5bphp arrayphp build your own arrayphp access array element with variableassociative array with value is an array phpphp array usearrays in phphow to make an array in phpcreaet new array in phpdeclaring array in phpcraete array in phphow to write array in php 24array phpdeclare an arrayy in phpphp function to create arrayphp array with arraysdata type of array element in phparray 28 29 in phpphp access an array of an arrayhow to create an array of items in php 40array in phparrays with named indexes phphow do you create an array in php 3fphp initialize array stringphp arrary indexphp declare array with valuesphp array literalsdefining php arrayarray get phpaccess an array from within a function phparays in phpcreate array in php