Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Phore core library

Actions Status

Install

composer requre phore/core

Basic usage

Pluck

$data = ["some"=>["path"=>"data"]];

assert( "data" === phore_pluck("some.path", $data) );

assert( "data" === phore_pluck(["some", "path"], $data) );

assert( "fail" === phore_pluck("unknown", $data, "fail") );
phore_pluck("unknown", $data, new InvalidArgumentException("path missing"));


// if default is array, phore_pluck will ensure to return array
assert ( [] == phore_pluck("some.path", $data, []) );

Transform Array

$input = ["a", "remove"];


$out = phore_array_transform($input, function ($key, $value) {
    if ($key == "remove")
        return null;
    return ["x"=>"y"];
});

assert([["x"=>"y"]] == $out);

Text functions

  • phore_text_unindent(string $input)

phore_random_str()

Wrapper around libsodium and