Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12741186
ListOperation.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
ListOperation.php
View Options
<?php
class
ListOperation
{
/**
* Adds two lists
*
* @param Array $a The left list
* @param Array $b The right list
* @return Array The resultant list
*/
public
static
function
Add
(
$a
,
$b
)
{
return
array_merge
(
$a
,
$b
);
}
/**
* Intersects two lists
*
* @param Array $a The left list
* @param Array $b The right list
* @return Array The resultant list
*/
public
static
function
Intersect
(
$a
,
$b
)
{
if
(
count
(
$a
)
==
0
||
count
(
$b
)
==
0
)
{
return
array
();
}
return
array_intersect
(
$a
,
$b
);
}
/**
* Substracts a list from another list
*
* @param Array $a The left list
* @param Array $b The right list
* @return Array The resultant list
*/
public
static
function
Substract
(
$a
,
$b
)
{
if
(
count
(
$b
)
==
0
)
{
return
$a
;
}
$result
=
array
();
foreach
(
$a
as
$key
=>
$value
)
{
$toRemove
=
false
;
foreach
(
$b
as
$itemToRemove
)
{
if
(
$value
==
$itemToRemove
)
{
$toRemove
=
true
;
break
;
}
}
if
(!
$toRemove
)
$result
[
$key
]
=
$value
;
}
return
$result
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 16, 13:22 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3146369
Default Alt Text
ListOperation.php (1 KB)
Attached To
Mode
rTOOLS Nasqueron Tools
Attached
Detach File
Event Timeline
Log In to Comment