PHPackages                             mlavrk/array-random-value - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mlavrk/array-random-value

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mlavrk/array-random-value
=========================

Provides simple function to get random value from array

1.0.1(1y ago)02MITPHPPHP &gt;=7.0

Since Jan 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mlavrk/array-random-value)[ Packagist](https://packagist.org/packages/mlavrk/array-random-value)[ RSS](/packages/mlavrk-array-random-value/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Array Random Value
==================

[](#array-random-value)

[![tests workflow](https://github.com/mlavrk/array-random-value/actions/workflows/test.yml/badge.svg)](https://github.com/mlavrk/array-random-value/actions/workflows/test.yml/badge.svg)

A simple PHP library that provides a utility function to get a random value from an array. It uses the `random_int()` function for secure randomness. If the array is empty, the function returns `null`.

Disclaimer
----------

[](#disclaimer)

This project is created for learning purposes. However, the functionality is fully implemented and works correctly. Feel free to use it in your projects, but keep in mind that it’s not intended for production-critical use cases.

Installation
------------

[](#installation)

```
composer require mlavrk/array-random-value
```

Usage
-----

[](#usage)

```
