Creating arrays in PHPWe will create an array and assign multiple values to this array like this
We can create an array with assigned Key and values like this.
Creating array by breaking stringWe can create an array by breaking string. Let us try with some simple examples.
Here we have used space as delimiter and creaed the array by breaking the string.
The output of above code is here.
Now let us try another program. This is a keyword list, we will try to create array by breaking the string with coma as delimiter. Only changes to above code is shown here
Output is here
If you want to know how many keywords are present by using array_size then here is the code.
Output of this is here
Creating array by using range()We can specify a range and step to create an array by using numbers or chars between the range.
Output
This article is written by plus2net.com team.
![]() |
|