Using foreach
loop without key
foreach($array as $item) { echo $item['filename']; echo $item['filepath']; // to know what's in $item echo '<pre>'; var_dump($item); }
Using foreach
loop with key
foreach($array as $i => $item) { echo $item[$i]['filename']; echo $item[$i]['filepath']; // $array[$i] is same as $item }
Using for
loop
for ($i = 0; $i < count($array); $i++) { echo $array[$i]['filename']; echo $array[$i]['filepath']; }
var_dump
is a really useful function to get a snapshot of an array or object.
Related Posts:
- How to add elements to an empty array in PHP?
- PHP array printing using a loop
- WordPress Warning: preg_replace(): JIT compilation failed: no more memory
- Append code into wp-config.php
- lazy load comments wordpress on click
- Use Filename for Alt and Title Tags
- How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
- Trying to use Ternary operators with WP Conditionals
- Filter link to existing content suggestion
- How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context
- How to return multiples lines in a shortcode?
- wp_enqueue_style with style.php and WordPress functions
- Generate an array of parent/child page IDs, based on parent page name
- fallback image for featured image
- Add attribute / custom attribute to product in woocommerce
- Access/update database with jQuery
- wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09
- How to create another version of my site based on the same database
- How to get bool with `get_option()` when already registered setting with type `boolean`
- Why is this Ajax not working?
- Stumped on migration
- Count the number of times the search form template gets included on a page
- Displaying theme options in css
- Using $_GET in Functions.php [closed]
- How to show part of the_content?
- PHP help get_template_directory + PHP include
- WordPress plugin/code to hide all things related of a user from the public
- Call a PHP Function with Multiple Parameters that is outside the AJAX Handler
- Querying wpdb using PHP
- Reload part of checkout on changed shipping method
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- edit search.php to include subdomain posts
- Remove echo from shortcode
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- Should `wp_login` be used since it’s deprecated?
- Category title output before opening title tag
- unable to use ‘new WP_Query’ in AJAX call
- admin-ajax Firing Error 400 When Logged In
- How to use a custom hook
- Jquery window.send_to_editor function
- PHP: Showing currency sign if input is a number
- Automatic excerpt is not shown with the_excerpt() command
- Multiple requests external data api dynamic block gutenberg
- Woocommerce with Lazy Load php and ajax
- How to check $_GET isset for a parameter and value? [closed]
- Get post categories
- Handling PHP/HTML inside the output of a shortcode function
- change title page on search result
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Refactoring long if/else php chains
- Update post meta – Custom field does not match meta-key
- Need help removing […] after excerpt
- How to add aria role and schema markup to custom walker container
- How to replace URL protocol using PHP?
- WPDB secure custom form
- setcookies and header send
- is_user_logged_in returning nothing on custom page
- Disable category RSS Feeds on WordPress blog with PHP
- Insert content into head tag with function
- Pagination in single.php
- Why wp_remote_get() fetches certain web pages while it doesn’t work for my localhost?
- Getting text from custom field from customizer
- WordPress navigation wont appear with wp_head
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- Execute function only for specific user roles
- Create plugin with custom page and template caused an error `Call to undefined function get_header()`
- WordPress redirects to localhost
- Pass a PHP function to javascript
- Nested Queries of decreasing specificity
- Include User ID in iFrame URL
- Variant Item SKU as Product Code
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- static page pagination not working
- Add a new view on the Woocommerce account page
- alternate left – right content inside the loop
- I have a lot of JavaScript erorrs after SSL someone can help me?
- Collect all events in one year
- Show the subcategory name based on current product
- Why my Ajax events are no longer detected after dynamic change of shortcode content
- Getting an empty space in up sell items
- How to make this code valid only when the value exists?
- How to include a function in a template with template tag
- wordpress all post filter by year
- Vertical Menu for one page only
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Use header option on wp-login page with a second logo
- Display a single row from nested array of custom field data
- Pulling a variable into the wp_nav_menu function
- global $post inside plugin query messes up every new post page in wp-admin
- Create a custom theme-specific page, invisible in the admin-panel?
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- wp nav menu without label
- Plugin PHP write permissions
- !in_array doesnt recognize category
- WXR XML import is stripping php tags that I need to keep
- How to remove parent section in an attachment URL in wordpress?
- How to customize posts in WordPress by using HTML and CSS?
- paginate_links() returns NULL instead of the pagination links, but pagination is actually happening
- is it possible to create cart functionality without woocommerce? [closed]