Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
Helpers
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Modulus
Helpers
Commits
eb3557b5
Commit
eb3557b5
authored
Apr 18, 2020
by
Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout d'un helper array - test de tableau indexé
parent
5aa9938d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
README.md
README.md
+14
-2
composer.json
composer.json
+1
-0
src/array.php
src/array.php
+14
-0
No files found.
README.md
View file @
eb3557b5
...
...
@@ -43,6 +43,9 @@ Laravel 5.8 uses autoload files, so doesn't require you to manually add the Serv
-
[
str_indent
](
#str_indent
)
-
[
str_args_to_array
](
#str_args_to_array
)
**_Array_**
-
[
is_indexed_array
](
#is_indexed_array
)
**_Time_**
-
[
sum_times
](
#sum_times
)
-
[
gte_time
](
#gte_time
)
...
...
@@ -269,7 +272,6 @@ $getters = ['content.key', 'content.value'];
$price
=
mixte_get_multi
(
$source
,
$getters
,
$default
=
null
);
// ["my-key", "my-value"]
```
#### `public_folder_to_urls()`
...
...
@@ -278,9 +280,19 @@ La fonction `public_folder_to_urls()` récupère une colelction d'url de fichier
```
php
$urls
=
public_folder_to_urls
(
"upload/folder/"
);
// Collection(['http://domain.tld/upload/folder/images1.png', 'http://domain.tld/upload/folder/images2.png'])
```
is_indexed_array
#### `is_indexed_array()`
La fonction
`is_indexed_array()`
teste un tableau pour savoir s'il est de type indexé ou associatif
```
php
$urls
=
is_indexed_array
([
'foo'
,
'bar'
]);
// true
$urls
=
is_indexed_array
([
'foo'
=>
'bar'
,
'boo'
=>
'tite'
]);
// false
```
## Security
...
...
composer.json
View file @
eb3557b5
...
...
@@ -18,6 +18,7 @@
"files"
:
[
"src/convert.php"
,
"src/divers.php"
,
"src/array.php"
,
"src/image.php"
,
"src/html.php"
,
"src/list.php"
,
...
...
src/array.php
0 → 100644
View file @
eb3557b5
<?php
if
(
!
function_exists
(
'is_indexed_array'
))
{
/**
* Test si un tableau est de type indexé
*
* @param array Le tableau à tester
* @return bool
*/
function
is_indexed_array
(
array
$array
)
:
bool
{
return
array_keys
(
$array
)
===
range
(
0
,
count
(
$array
)
-
1
)
&&
count
(
$array
)
==
1
;
}
}
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