Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
7f5d047e
Commit
7f5d047e
authored
Sep 21, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continued adding comments to arr class.
parent
8711bb3d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
+24
-1
laravel/arr.php
+24
-1
No files found.
laravel/arr.php
View file @
7f5d047e
...
...
@@ -42,6 +42,13 @@ class Arr {
*
* The same "dot" syntax used by the "get" method may be used here.
*
* If no key is given to the method, the entire array will be replaced.
*
* <code>
* // Set the $array['user']['name'] value on the array
* Arr::set($array, 'user.name', 'Taylor');
* </code>
*
* @param array $array
* @param string $key
* @param mixed $value
...
...
@@ -71,6 +78,14 @@ class Arr {
/**
* Return the first element in an array which passes a given truth test.
*
* <code>
* // Return the first array element that equals "Taylor"
* $value = Arr::first($array, function($k, $v) {return $v === 'Taylor';});
*
* // Return a default value if no matching element is found
* $value = Arr::first($array, function($k, $v) {return $v === 'Taylor'}, 'Default');
* </code>
*
* @param array $array
* @param Closure $callback
* @return mixed
...
...
@@ -88,13 +103,21 @@ class Arr {
/**
* Remove all array values that are contained within a given array of values.
*
* <code>
* // Remove all array values that are empty strings
* $array = Arr::without($array, '');
*
* // Remove all array values that are "One", "Two", or "Three"
* $array = Arr::without($array, array('One', 'Two', 'Three'));
* </code>
*
* @param array $array
* @param array $without
* @return array
*/
public
static
function
without
(
$array
,
$without
=
array
())
{
foreach
(
$array
as
$key
=>
$value
)
foreach
(
(
array
)
$array
as
$key
=>
$value
)
{
if
(
in_array
(
$value
,
$without
))
unset
(
$array
[
$key
]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment