composer requre phore/core
$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, []) );
$input = ["a", "remove"];
$out = phore_array_transform($input, function ($key, $value) {
if ($key == "remove")
return null;
return ["x"=>"y"];
});
assert([["x"=>"y"]] == $out);
phore_text_unindent(string $input)
Wrapper around libsodium and