MaplePHP
  • MaplePHP - Layered structure MVC PHP framework
  • Guide
    • Get started
    • Installation
    • Service Provider
    • Dependency injector
    • Controller
    • Middlewares
    • Routers
  • Navigation
    • Simple navigation
    • Dynamic navigation
  • Template engine
    • Getting started
    • Templates
      • Index
      • Views
      • Partials
    • Content (DTO)
      • String
      • Number
      • Array
      • DateTime
      • Encode
      • Dom
  • Form builder
    • Form builder
  • Database
    • MySQL
  • Service providers
    • url
    • encode
    • dir
    • DB
    • responder
  • Installations
    • Authorization & login
  • Frontend template
    • Responder
    • Views & components
    • Modals
    • Redirects
  • Access
    • MaplePHP with Docker
  • Libraries
    • Container
    • MySQL queries
    • Validation
    • Cache
    • Logger
    • Request
    • Response
  • What is?
    • Dependency injector
    • Controller
    • Middleware
    • Router
Powered by GitBook
On this page
  • MaplePHP Format Array Library
  • Array Manipulation Methods

Was this helpful?

  1. Template engine
  2. Content (DTO)

Array

MaplePHP Format Array Library

This PHP library, named MaplePHP\DTO\Format\Arr, provides functionality for formatting arrays. Below is a guide to the methods available in this library.

Array Manipulation Methods

unset(keys)

  • Unsets specified keys from the array.

  • Parameters:

    • keys: Keys that you want to unset (e.g., @unset("username", "password", "email", ...)).

arrayKeys()

  • Gets array keys.

shift(?Str &$shiftedValue = null): self

  • Shifts the first element off the array.

  • Parameters:

    • $shiftedValue: Reference to the variable where the shifted value will be stored.

pop(?Str &$poppedValue = null): self

  • Pops the last element off the array.

  • Parameters:

    • $poppedValue: Reference to the variable where the popped value will be stored.

wildcardSearch(string $search): self

  • Extracts all array items with a specified array key prefix.

  • Parameters:

    • $search: Wildcard prefix to search for.

fill(int $index, int $times, string $value = " "): self

  • Fills the array with a value for a specified range.

  • Parameters:

    • $index: The starting index.

    • $times: The number of elements to fill.

    • $value: The value to fill.

count(): int

  • Returns the count/length of the array.

walk(callable $call): self

  • Applies a user-defined function to each element of the array.

  • Parameters:

    • $call: Callable function to apply to each element.

PreviousNumberNextDateTime

Last updated 1 year ago

Was this helpful?