- Declare Simple Array (indexed arrays): $something = array(10, 20, 30);
- Display Second Element: echo $something[1];
- Output: 20.
- Declare Array and assign value
- $var = array();
- $var[] = 'deer';
- Declare Simple Array (associative arrays): $something = array(“a”=>10, “b”=>20, “c”=>30);
- Display Second Element: echo “I got “.$something[‘a’].” in Physics.”;
- Output: I got 10 in Physics.
- Find out the number of elements of an array is used by count() function : echo count($something);
- If only echo $something;
- Output: Array.
- User echo $something[0];
- $a = "Iftekhar";
- $something = (array) $a;
- echo $something[0];
- Output: Iftekhar.
- Marge array
- $defaults = array_merge( $defaults, array(
'infinite-scroll' => array(
'container' => '.entries-wrapper',
'total-posts' => $wp_query->found_posts,
'posts-per-page'=> $wp_query->query_vars['posts_per_page'],
'method' => $settings['inf_scroll_method']
) - Change key to value and value to key of an Array
- $flipped = array_flip($myArray);
- Marge a new value into Array
- $output[] = $abc
- Returns an array if containing the keys
- $curArray = array_keys('$myArray', 'galib');
- Specific value search
- Return TRUE/False
- Case-sensitive
- if( in_array( "mizan", $myArrat ) ){echo "Found"; }
No comments:
Post a Comment