Skip to content

ottosmops/ids

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parse ids to an array

Software License Latest Stable Version Build Status Packagist Downloads

Idea

For PHP CLI or Api, if you want to have an option for one or more ids (integers), this very small package is a helper, which parses a string to an array of ids.

Input Output
1 [1]
1,2 [1,2]
1-3 [1,2,3]
1-5,7,8 [1,2,3,4,5,7,8]

Usage

The usage is very simple:

$ids = '1-3';
$array = Ids::parse($ids); // [1,2,3]

License

The MIT License (MIT). Please see License File for more information.