From faac430f5b52427fc89ee723bfa601c649b829a5 Mon Sep 17 00:00:00 2001 From: Taufek Johar Date: Sat, 13 May 2017 11:18:53 +0000 Subject: [PATCH] Add PHP Module Added PHP function to produce PHP related information. --- modules/php/README.md | 10 ++++++++++ modules/php/functions/php-info | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 modules/php/README.md create mode 100644 modules/php/functions/php-info diff --git a/modules/php/README.md b/modules/php/README.md new file mode 100644 index 00000000..5eeb8d4e --- /dev/null +++ b/modules/php/README.md @@ -0,0 +1,10 @@ +PHP +====== + +Provides function and environment variables related to PHP. + +Functions +--------- + + - `php-info` exposes information about the PHP environment via the + `$php_info` associative array. diff --git a/modules/php/functions/php-info b/modules/php/functions/php-info new file mode 100644 index 00000000..ec9c36bd --- /dev/null +++ b/modules/php/functions/php-info @@ -0,0 +1,22 @@ +# +# Exposes information about the PHP environment via the $php_info associative +# array. +# +# Authors: +# Taufek Johar +# + +local version + +# Clean up previous $php_info. +unset php_info +typeset -gA php_info + +if (( $+commands[php] )); then + version="${${$(php --version)[(w)1,(w)2]}/ /-}" +fi + +# Format version. +if [[ -n "$version" ]]; then + php_info[version]="$version" +fi