[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set

Description

Return the array[index] or array->index (for an object) or a default value if not set

Note: This code is slightly more efficient with the default being assigned in the else than when there is just one assignment of $value = $default right at the start where slightly more is 2 or 3 microseconds – measured on a laptop.

Usage

bw_array_get( $array, $index, $default );

Parameters

$array
( mixed ) required –
$index
( mixed ) required –
$default
( mixed ) optional –

Returns

void

Source

File name: oik-bwtrace/includes/bwtrace.php
Lines:
1 to 22 of 22
  function bw_array_get( $array, $index, $default=NULL ) {
    if ( isset( $array ) ) {
      if ( is_array( $array ) ) {
        if ( isset( $array[$index] ) || array_key_exists( $index, $array ) ) {
          $value = $array[$index];
        } else {
          $value = $default;
        }  
      } elseif ( is_object( $array ) ) {
        if ( property_exists( $array, $index ) ) {
          $value = $array->$index;
        } else {
          $value = $default;
        } 
      } else {
        $value = $default;
      }  
    } else {
      $value = $default;
    }  
    return( $value );
  }
 
 View on GitHub View on Trac

Called by

1 to 15 of 488
  • api_call_mapper::map() –
  • bobbcomp::bw_array_get_dcb() – Return the array[index] or build the result by calling $callback, passing the $default as the arg.
  • bw() – Return the styled "Bobbing Wide" string
  • bwsc_jquery() – Implement the [bw_jq] shortcode
  • BW_::bw_emailfield() – Form an "email" field
  • BW_::bw_emailfield_arr() – Create an emailfield for an array options field
  • BW_::bw_radio() – Display a group of radio buttons
  • BW_::bw_select_arr() – Create a select for an array options field
  • BW_::bw_textarea() – Form a "textarea" field
  • BW_::bw_textarea_arr() – Create a textarea for an array options field
  • BW_::bw_textarea_cb_arr() – Create an optional textarea
  • BW_::bw_textfield() – Form a text field
  • BW_::bw_textfield_arr() – Create a textfield for an array options field
  • bw_accordion() – Display pages styled for jQuery accordion
  • bw_action_file() – Determine the name of the action file
[1][2][3]…[33]Next »

Invoked by

    Calls

    Call hooks

    Function name: bw_array_get
    Plugin ref: oik-bwtrace – debug trace for WordPress
    Version: 4.1.0
    Sourcefile: includes/bwtrace.php
    File ref: includes/bwtrace.php
    Deprecated?: No
    API Letters: A,B,G

    Published: March 11, 2017 | Last updated: December 21, 2017

    Information

    Function name: bw_array_get
    Plugin ref: oik-bwtrace – debug trace for WordPress
    Version: 4.1.0
    Sourcefile: includes/bwtrace.php
    File ref: includes/bwtrace.php
    Deprecated?: No
    API Letters: A,B,G

    Recent plugin updates

    oik-weight-zone-shipping v0.2.13 oik-weight-zone-shipping v0.2.13 has been tested with WooCommerce 10.1.2 and WordPress 6.8.2 ...
    SB Children Block v1.3.0 Upgrade to SB Children Block v1.3.0 for support for PHP 8.3 and PHP 8.4  ...
    oik v4.15.3 Update to oik v4.15.3 for a couple of security fixes. Tested with WordPress 6.8.2 ...
    oik-privacy-policy v1.4.9 Update to oik-privacy-policy v1.4.9 for a security fix. Tested with WordPress 6.8.2 and PHP 8.3 and PHP 8.4 ...
    oik-nivo-slider v1.17.0 oik-nivo-slider v1.17.0 introduces the Nivo slider block - oik-nivo-slider/nivo. ...

    Plugins

    • All Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins

    Themes

    • FREE themes
    • Bespoke themes
    • Premium themes

    Blocks

    • All Blocks
    • Block examples
    • About Blocks

    Shortcodes

    • All Shortcodes
    • Shortcode examples
    • About Shortcodes

    Reference

    • About APIs
    • All APIs
    • All Classes
    • All Files
    • All Hooks

    Support

    • Contact
    • Cookies policy
    • Get API key
    • Privacy
    • Request support
    • Sitemap
    • Stay informed
    • Terms and Conditions
    oik-plugins
    Email: herb@bobbingwide.com

    Weight shipping plugins

    Find out which cart weight shipping plugin you need for your WooCommerce site.
    Which cart weight based plugin do I need?

    Site:  www.oik-plugins.com
    © Copyright oik-plugins 2011-2025. All rights reserved.


    Website designed and developed by Herb Miller of Bobbing Wide
    Proudly powered by WordPress and oik-plugins

    WordPress version: 6.8.3

    Gutenberg version: 21.7.0

    PHP version: 8.2.29