FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/tests/array.php at master · barryzpc/framework · GitHub
barryzpc
framework
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
tests
/
array.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (38 loc) · 729 Bytes
Breadcrumbs
framework
/
tests
/
array.php
Copy path
File metadata and controls
43 lines (38 loc) · 729 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
define
(
'
DEBUG
'
,
'
on
'
);
define
(
'
WEBPATH
'
,
realpath
(
__DIR__
.
'
/..
'
));
//包含框架入口文件
require
WEBPATH
.
'
/libs/lib_config.php
'
;
$
n
=
4
;
$
array
=
new
\
Swoole
\
ArrayObject
();
$
array
[
'
test1
'
] =
123
;
$
array
[
'
test2
'
] =
456
;
$
array
[
'
test3
'
] =
789
;
if
(
$
n
==
1
)
{
$
array
->
each
(
function
(&
$
item
,
$
key
)
{
var_dump
(
$
item
,
$
key
);
$
item
=
rand
(
100
,
999
);
});
}
elseif
(
$
n
==
2
)
{
var_dump
(
$
array
->
reverse
());
}
elseif
(
$
n
==
3
)
{
$
newArray
=
$
array
->
map
(
function
(
$
item
)
{
var_dump
(
$
item
);
return
rand
(
100
,
999
);
});
var_dump
(
$
newArray
);
}
elseif
(
$
n
==
4
)
{
echo
$
array
->
reduce
(
function
(
$
result
,
$
item
)
{
return
$
result
+
$
item
;
});
}
Back
|
FazBrowse Home
|
New Git URL