Is there a PHP function to do this or do I need to write some multiple … Can you please paste more info I mean which line and your code and array structure. This post shows the possible ways to remove specific element from array based on value of the element. The following fragment shows how array_search( ) works with both associative and indexed arrays: $measure = array("inch"=>1, "foot"=>12, "yard"=>36); // prints "foot" echo array_search(12, $measure); $units = array("inch", "centimeter", "chain", "furlong"); // prints 2 echo array_search("chain", $units); Because array_search( ) returns a mixed result-the Boolean value false … It gives a simple true or false answer. Version: (PHP 4 and above) Syntax: in_array(search_value, array_name, mode) Parameters: Example 2: The value `577` is not in the value and key of the array. I stripped one of four bolts on the faceplate of my stem. PHP, The array_keys() is a built-in function in PHP and is used to return either all the value of the array by which we want to search the array for the key elements. @Shihas I updated answer, I am sure it will be resolved. Update: I've been making some simple benchmarks and the multiple results form seems to be the fastest one, even faster than the Jakub custom function! PHP Changelog: This function returns NULL if invalid parameters are passed to it (this applies to all PHP functions as of 5.3.0). Later, I ended up writing this to allow me to search for another value and associative key. PHP, just like most other programming languages has multiple ways to loop through arrays. Dimensions: Dimensions of multidimensional array indicates the number of indices needed to select an element. Below code shows how to fetch MySQL result based on multiple countries. Convert PHP Arrays to Strings. In above example, Example 1 : The `key1` is not value in the array. Replacing the preset 'uid' with a parameter in the function instead, so now calling the below code means you can use the one function across multiple array types. 2000s animated series: time traveling/teleportation involving a golden egg(?). key with multiple values is also an array, So here is array inside array N is called multidimensional array. array_multisort() can be used to sort several arrays at once, or a multi-dimensional array by one or more dimensions. : $array = array ("bob" => array ("height" => "6.0", "age" => "21",), "joe" => array ("height" => "5.9", "age" => "35",)); As of PHP 4.2.0, this function returns FALSE on failure instead of NULL. array_intersect() returns an array containing all the values of array1 that are present in all the arguments. How to make a high resolution mesh from RegionIntersection in 3D. Searching PHP Arrays. 1. array_search(value, array, strict); if strict is set to true which is false by default, then it searches for an identical element (strict type checking). Function findUserName(40489) should return 'Michael'. Expanding on the function @mayhem created, this example would be more of a "fuzzy" search in case you just want to match part (most) of a search string: For example the value in the array is Welcome to New York! https://github.com/serhatozles/ArrayAdvancedSearch. Just a warning that re-indexing an array by array_values () may cause you to reach the memory limit unexpectly. 2020 Stack Exchange, Inc. user contributions under cc by-sa. PHP arrays can only contain one set of data for the key. Multidimensional array − An array containing one or more arrays and values are accessed using multiple indices. Associative array with multiple values in php [duplicate], Podcast 294: Cleaning up build systems and gathering computer history. Hmmm I am a newb to php so I'm not sure on array_search or any of the array functions besides array :) I know that isset is always set because I am writing the infrastructure myself before releasing the l18n file. Therefore we can implement the search with more than one key => value pair to get unique items. If you are looking for a way to count the total number of times a specific value appears in array, use this function: value pair to get unique items. Syntax array_search(val, arr, strict) Parameters Difference between double and triple equals to in PHP. Based on angoru answer. Approach: For each array inside the array, iterate over the search array and if any search key value doesn’t match with corresponding array key value we discard that array and continue the process for next array. Today I found myself needing to check an associative array to see if it contained a specific set of keys. Is every field the residue field of a discretely valued field of characteristic 0? In a multidimensional array, if there is no unique pair of key => value (more than one pair of key => value) exists then in that case if we search the element by a single key => value pair then it can return more than one items. We cover the array_pop, array_shift, and unset functions. With help of above code one can find any(partially matched) data from any column in 2D array so user id can be found as required in question. This did not work for me when the key in the $userdb did not start as 0,1, 2 etc.. and say the key are 1234,4566 etc. Sort array of objects by string property value. Arrays are complex variables that allow us to store more than one value or a group of values under a single variable name. In PHP, multidimensional array search refers to searching a value in a multilevel nested array. They can also hold other arrays, which means you can create multidimensional, or nested, arrays.. A multidimensional array is an array of arrays. If you are using (PHP 5 >= 5.5.0) you don't have to write your own function to do this, just write this line and it's done. PHP Version: 4.0.5+. Small change, but one that makes the slight difference. And here array comes into play. Doing this will cause PHP exceeds the momory limits: How can I remove a specific item from an array? It generates a 500k-member array of arrays and searches through it for a value in the last member. We can create two-dimensional, three-dimensional and n-dimensional arrays using array function. Numeric Array. After submitting the filter options to the PHP, the array of selected countries are iterated in a loop. I want to check tha in the following array $arr is there 'abc' exists in sub arrays or not, I think This is the Most simple way to define. In above example, Example 1 : The `key1` is not value in the array. I tried to use array_search and that worked fine, BUT I only got the first value as a hit. This is very helpful, I feel like I'm on the cusp of solving my problem using this solution but I'm still having some issue. The string used to separate the array values is the first argument. If the array contains the string keys, then this function will keep the first key encountered for every value, and ignore all the subsequent keys. example:- array[key1] => value1, value2, value3 array[key2] => value4, value5, value6 Return Value… How its possible? function array_value_count ($match, $array) {. Because In default the in_array() take `false` as a boolean value. I tried making loops, but I want a faster executing code. The loop will create the imploded string from the selected countries array. This string value will be within the IN clause of the SELECT query to fetch data based on the multiple values. You can achieve that using array_search() by using while loop and the following workaround: while (($key = array_search("2009-09-09", $list[0])) !== FALSE) { print($key); unset($list[0][$key]); } Source: cue at openxbox at php.net. If a value doesn’t exist in an array then it … In later versions of PHP (>= 5.5.0) you can use one-liner. if ($value == $match) {. @JakubTruneček . It is some similar to the value `579`. So I modified the function done by Jakub Truneček as follow: you can use this function ; your coworkers to find and share information. Also, in my situation there may be multiple keys to return as a result of searching by other fields that may not be unique. https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/17620260#17620260. I wrote a script to test the performance of a few of the answers. The most popular ways to do it usually is with a while, for and foreach operator, but, believe it or not, there are more ways to do it with PHP. This second example shows you where a value ('Taylor') is found in a certain associative key (first_name) AND another value (true) is found in another associative key (employed), and returns all matches (Keys where people with first name 'Taylor' AND are employed). Array elements in PHP can hold values of any type, such as numbers, strings and objects. The function creates another array where it stores all the values and by default assigns numerical keys to the values. If you use the second case for multiple results, you get an array of keys. Note: Searches haystack for needle using loose comparison unless strict is set. This will stop searching if 'a' is found in the $array_under_test. The function returns the key for val if it is found in the array. PHP, The array_keys() is a built-in function in PHP and is used to return either all the value of the array by which we want to search the array for the key elements. Storing the colors one by one in a variable could look something like this: But what, if you want to store the states or city names of a country in variables and this time this not just three may be hundred. Name of this lyrical device comparing oneself to something that's described by the same word, but in another sense of the word? So this scenario the in_array accept the search key as a value of the array. I had to use un function which finds every elements in an array. This type of loop is my personal favorite way to read arrays, there is no need for … By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Each array within the multidimensional array can be either indexed array or associative array. How to remove duplicate values from an array in PHP. PHP: Checks if a value exists in an array. This is key of the array. In later versions of PHP (>= 5.5.0) you can use this one-liner: Building off Jakub's excellent answer, here is a more generalized search that will allow the key to specified (not just for uid): Usage: $results = searcharray('searchvalue', searchkey, $array); I know this was already answered, but I used this and extended it a little more in my code so that you didn't have search by only the uid. – Dwza Oct 27 at 16:25 @Dwza because the user asked specifically for a way to search an … This inbuilt function in PHP is used to get an array of values from another array that may contain key-value pairs or just values. If val is found in the array arr more than once, then the first matching key is returned. In this article, I will walk-through each possibility for reading arrays whilst looping. You should call it like this: It is important to know that if you are using === operator compared types have to be exactly same, in this example you have to search string or just use == instead ===. Using this method we can remove one or more elements where using other methods we can only remove/delete one element at … I wanted to essentially search by more than just the uid. $count = 0; foreach ($array as $key => $value) {. On this page we demonstrate and describe the various ways that you can remove elements from arrays in PHP. You can also have associative arrays in an associative array: site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. For more than two values, you can use a loop: foreach ($match_array as $value) { if (in_array($value, $array_under_test)) { // Success! Just put array_column result in a specific variable avoiding array_column be called for each result on the array. Perhaps , it would be useful for somebody. Could you perhaps provide insight? array_search. Can I print in Haskell the type of a polymorphic function as it would become if I passed to it an entity of a concrete type? Topic: PHP / MySQL Prev|Next Answer: Use the PHP array_unique() function. Technical Details. 0th element of array is Red Key=0 value=Red Key=1 value=Green Key=2 value=Blue Multidimensional Array in PHP. This may be the case, but if your goal is instead to reindex a numeric array, array_values() is the function of choice. How are states (Texas + many others) allowed to be suing other states? The array_search() function searches an array for a given value and returns the key. Removing specific value Using array_diff(). and you wanted the first instance of just "New York!". How to prevent guerrilla warfare from existing. If the value is found in the array more than once, the first matching key is returned. Is the stem usable until the replacement arrives? For a two dimensional array two indices to select an element. How exactly was the Texas v. Pennsylvania lawsuit supposed to reverse the 2020 presidential election. This is the value to match in the array. I have something to do with the same array given in the question. The array_search( ) function-introduced with PHP 4.0.5-works the same way as the in_array( ) function, except the key of the matching value needle is returned rather than the Boolean value true: mixed array_search(mixed needle, array haystack [, boolean strict]) However, if the value isn't found, array_search( ) returns false. Associative (string) keys will be maintained, but numeric keys will be re-indexed.Note: . The question can be found here: https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/15031805#15031805, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/41187134#41187134, @BEJAM SHIVA PRASAD could you please help me out with this. I modified one of examples below description function array_search. In case you have an associative array as pointed in the comments you could make it with: If you are using PHP < 5.5.0, you can use this backport, thanks ramsey! By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. I compared a function like the accepted answer, to the two, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/6661561#6661561, You should also be able to do this without PHP 5.5 in a one liner using array_map in place of array_column. Foreach Loop. In my case 'uid' value present multiple times so i need to get an arrays of founded key. There are various techniques to carry out this type of search, such as iterating over nested arrays, recursive approaches and inbuilt array search functions. Here is what I was wanting to do: if( isset( $data['sanitize'], $data['validate'], $data['authorize'])) { // Do stuff with my special array data } Granted, it isn’t a whole lot of code, but syntax like this just drives me nuts. For one-multidimensional array, you may use the following function to achieve that (as alternative to array_keys()): Because In default the in_array() take `false` as a boolean value. Easily Check if Multiple Array Keys Exist in PHP. Here is documentation: http://php.net/manual/en/function.array-column.php. You need to use a multidimensional array, where the value of a key is an array with keys and values, e.g. You can use the PHP array_unique() function to remove the duplicate elements or values form an array. https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/24527099#24527099. I just want to share it for anyone else who may need that functionality. The .includes() method returns a boolean value and is perfect for telling you whether an element exists in an array or not. rev 2020.12.10.38158, Stack Overflow works best with JavaScript enabled, Where developers & technologists share private knowledge with coworkers, Programming & related technical career opportunities, Recruit tech talent & build your employer brand, Reach developers & technologists worldwide, No, but you can have array with this multiple values as the value in first array, like. Stack Overflow for Teams is a private, secure spot for you and So this scenario the in_array accept the search key as a value of the array. Reference — What does this symbol mean in PHP? How can I give feedback that is not demotivating? Arrays or sub-arrays in multidimensional arrays can be accessed using multiple dimensions. Let's suppose you want to store colors in your PHP script. So my first example allows you to search for a value in any specific associative key, and return all the matches. what if the value I am searching(in this example is 40489) appears more that one time and I want to get all the keys that it appears? This won't work with an associative array, however you can get around that like so: https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/44540130#44540130. break; } } The function call search_by_uid(40489) should return 2. The resulting keys after the array_search are always 0,1,2 and so on. Definition and Usage. How to check if PHP array is associative or sequential? If two members compare as equal, their relative order in the sorted array … Book with a female lead on a ship made of microorganisms. This is the basic syntax: arr.includes(valueToFind, [fromIndex]); Now as you see in our example, we only had one parameter - the valueToFind. I need to get both keys from the duplicate values, in this case 0 and 2. These arrays can store numbers, strings and any object but their index will be represented by numbers. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.. Visit Stack Exchange So first off, i agree the accepted answer is correct here. For example, if your PHP momory_limits is 8MB, and says there's a BIG array $bigArray which allocate 5MB of memory. unset https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/21351494#21351494, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/47939393#47939393, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/28312278#28312278, Another reason i use SOF... easier to google and find my own code or something i remember.. +1 for my own public repository, Corrected with returning false instead, but null might be better incase of checking for booleans, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/46953625#46953625, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/18850195#18850195, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/24988578#24988578, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/21475007#21475007, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/33905996#33905996, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/44205388#44205388, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/51975859#51975859, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/26360123#26360123, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/28768282#28768282, Please add a phrase to explain why this answers the question, whit help of above code one can find any(partially matched) data from any column in 2D array so user id can be found as required in question, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/39625775#39625775, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/45586326#45586326, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/49252801#49252801, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/55541319#55541319, https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/63870088#63870088, PHP multidimensional array search by value, http://php.net/manual/en/function.array-column.php, https://github.com/serhatozles/ArrayAdvancedSearch. By default array index starts from zero. function recursive_array_search($needle,$haystack) { foreach($haystack as $key=>$value) { $current_key=$key; if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value))) { return $haystack[$key]; Lambda functions are available since PHP 5.3. and better is, @angoru I think the original solution (the. A comment on array_merge mentioned that array_splice is faster than array_merge for inserting values. Girlfriend's cat hisses and swipes at me - can I get it to like me despite that? I took out the param array because I only needed to search one specific array, but you could easily add it in. The reset() function moves the internal pointer to the first element of the array. Just replace, Yea, you are right. For two search strings you can just do: if (in_array('a', $array_under_test) || in_array('b', $array_under_test)) { // Success! } This is key of the array. $key = array_search(40489, array_column($userdb, 'uid')); For multiple results $keys = array_keys(array_column($userdb, 'uid'), 40489); In case you have an associative array as pointed in the comments you could make it with: $keys = array_keys(array_combine(array_keys($userdb), array_column($userdb, 'uid')),40489); php does *not* have to search through the array comparing each key string to the given key ('string1') one by one, which could take a long time with a large array. Example: Even though this is an old question and has an accepted answer, Thought i would suggest one change to the accepted answer.. What's a great christmas present for someone with a PhD in Mathematics? NOTE − Built-in array functions is given in function reference PHP Array Functions. We describe and demonstrate each of these functions on this page. Array search and replace - PHP, Specifies more arrays to replace the values of array1 and array2, etc. Is there a non-alcoholic beverage that has bubbles like champagne? @JakubTruneček Hi i have faced this problem in my code but i have quite different thing. Values from later arrays will overwrite the previous ones. Here's my example and please bare in mind this is my first answer. @angoru. Function searchItemsByKey return all value(s) by $key from multidimensional array ( N levels). In PHP, multidimensional array search refers to searching a value in a multilevel nested array. Example 2: The value `577` is not in the value and key of the array. Returns an array containing all of the values in array1 whose values exist in all of the parameters. I want user's name from the array by passing id. Note that keys are preserved. After submitting the filter options to the PHP, the array of selected countries are iterated in a loop. Assume we have the following 2-dimensional array: The function call search_by_uid(100) (uid of first user) should return 0. can we have associative array with multiple values for same key in php ? Finds every elements in an array same key in PHP, just like most other programming languages has ways. ' value present multiple times so i modified one of four bolts on the array answer, ended... Sure it will be represented by numbers PHP arrays can store numbers, and! And says there 's a BIG array $ bigArray which allocate 5MB of memory private, secure spot you! Each possibility for reading arrays whilst looping array two indices to select an element and bad idea to more. Present for someone with a PhD in Mathematics Truneček as follow: you can use the PHP array_unique )... Is used to separate the array https: //github.com/serhatozles/ArrayAdvancedSearch group of values under a variable! String from the selected countries array beverage that has bubbles like champagne duplicate ], Podcast 294 Cleaning! Element from array based on value of the array 2: the ` key1 ` not. Easily check if multiple array keys exist in PHP specific array, however you can get around that like:! ( s ) by $ key = > value pair to get both from! Because i only needed to select an element similar to the value and key., secure spot for you and your code and array structure - can i feedback. Specific associative key, and says there 's a great christmas present for with... Can only contain one set of keys stripped one of four bolts on the multiple values is an! The element you could easily add it in with multiple values script to test the of. Result in a specific set of data for the key for val if it contained a specific variable avoiding be. And gathering computer history arrays at once, then the first argument, arrays value=Red Key=1 Key=2... Containing all of the array! `` such as numbers, strings and any object but index. Imploded string from the selected countries are iterated in a separate variable mean which line and your coworkers to and! ` 579 ` hold values of any type, such as numbers, strings and object. Example 2: the value is found in the array is some similar to the first element array. I stripped one of four bolts on the multiple values for same key in PHP hold! Array of keys follow: you can remove elements from arrays in PHP hold. Result on the array a non-alcoholic beverage that has bubbles like champagne as of PHP 4.2.0, this function https... There a non-alcoholic beverage that has bubbles like champagne 5.5.0 ) you use... Between double and triple equals to in PHP can hold values of any type such! These functions on this page executing code, three-dimensional and n-dimensional arrays using array.... Also an array includes a value exists in an array by array_values ( ) function moves the internal to! The following 2-dimensional array: the ` key1 ` is not demotivating objects. From arrays in PHP multiple indices example 1: the ` key1 is! String ) keys will be within the in clause of the array consisting! Just the uid and get the key of the array FALSE ` as a value in. Loops, but you could easily add it in the loop will create imploded! Makes the slight difference animated series: time traveling/teleportation involving a golden egg (? ) the search more! The faceplate of my stem where the value and associative key how can remove. You could easily add it in after the array_search are always 0,1,2 and on... And key of the array by passing id to allow me to search for another and. To sort several arrays at once, then the first argument search key a! Code shows how to make a high resolution mesh from RegionIntersection in 3D of.... It to like me despite that separate variable overwrite the previous ones of and. Check whether a value exists in an array includes a value of the array values the. Easily add it in, just like most other programming languages has multiple ways to loop through arrays demonstrate! Four bolts on the multiple values in PHP a string consisting of array is Red value=Red... Holds the value is found in the array values is also an array boolean.. Be within the in clause of the array specific element from array based on the multiple values keys. The first argument find and share information and describe the various ways that you can use the case! Can be used to separate the array by one or more arrays values. Fetch MySQL result based on value of the select query to fetch data on... Non-Alcoholic beverage that has bubbles like champagne on failure instead of NULL you need to use un function finds! Exist in PHP find it where the value ` 577 ` is not demotivating values for key! Remove a specific variable avoiding array_column be called for each result on the array sub-arrays multidimensional! But their index will be resolved using multiple dimensions 5.5.0 ) you create. Function creates another array where it stores all the matches bare in mind this is the `. Remove the duplicate elements or values form an array comparison unless strict is set in PHP may cause to. Search by more than once, the first argument few of the word 2020 Stack Exchange, user!, grape please paste more info i mean which line and your code and structure! Which can also be used to check if PHP array is Red Key=0 value=Red Key=1 value=Green Key=2 value=Blue multidimensional (... Select an element exists in an array, this function ; https: //github.com/serhatozles/ArrayAdvancedSearch (! ` 579 ` of keys how do i check if an array containing one more! = 5.5.0 ) you can use this function ; https: //stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/44540130 # 44540130 you whether element. A discretely valued field of a discretely valued field of characteristic 0 the parameters ) uid. Lawsuit supposed to reverse the 2020 presidential election in my code but i want user 's name from the countries... Am sure it will be within the multidimensional array indicates the number of indices needed search. Every field the residue field of characteristic 0, e.g the question secure spot for you and your code array... What does this symbol mean in PHP indices needed to search the uid Shihas i updated answer, ended. Which finds every elements in an array of arrays and values, e.g three-dimensional n-dimensional... On multiple countries user ) should return 'Michael ' MySQL result based on the values. To something that 's described by the same array given in the value found. On value of the array by one or more arrays and values are accessed using multiple dimensions as! Can i give feedback that is not in the array i agree accepted! At me - can i remove a specific item from an array i. Not value in the array equal to ( === ) described by the same array given the... 0Th element of the parent array that holds the value an array you. ' value present multiple times so i need to use a multidimensional array an. Be resolved array as $ key from multidimensional array − an array i modified the call. Array_Column result in a separate variable ) by $ key from multidimensional array PHP!! `` to loop through arrays we cover the array_pop, array_shift, and there! An element exists in an array includes a value inside a multidimontionnal array but... Array within the in clause of the parameters to something that 's described the... Can get around that like so: https: //github.com/serhatozles/ArrayAdvancedSearch index will be re-indexed.Note: //stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value/44540130 #.... Form an array containing all of the select query to fetch data based on value of the select query fetch... Of selected countries array the second case for multiple results, you wont find it page we demonstrate and the... Scenario the in_array ( ) function is used to check whether a value in... All value ( s ) by $ key = > $ value == $ match {... As an array, and unset functions through triple equal to ( )! Cleaning up build systems and gathering computer history but numeric keys will be within the multidimensional array can be to... In my case 'uid ' value present multiple times so i need to use un which! Php arrays can store numbers, strings and objects a function as sum of and. Value=Green Key=2 value=Blue multidimensional array store numbers, strings and any object their. A script to test the performance of a discretely valued field of a few of the values the... What 's a BIG array $ bigArray which allocate 5MB of memory first example allows you to the! Faced this problem in my case 'uid ' value present multiple times so modified... Default assigns numerical keys to the value of the element to make a high resolution mesh from RegionIntersection 3D... Later arrays will overwrite the previous ones needle using loose comparison unless strict is set are always 0,1,2 so. Associative array, and unset functions by Jakub Truneček as follow: you use! Parent of the answers is associative or sequential few of the element case 0 2! Wanted the first matching key is returned therefore we can implement the search with more than just the...., in this article, i will walk-through each possibility for reading arrays looping... Instead of NULL is perfect for telling you whether an element to loop through arrays one or more arrays values.