承接 mcaskill/php-fallback 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mcaskill/php-fallback

Composer 安装命令:

composer require mcaskill/php-fallback

包简介

Sets a given variable if it is not set.

关键字:

README 文档

README

(PHP 5 >= 5.6)
fallback — Sets a given variable if it is not set.

Description

mixed fallback( mixed &$var [, mixed $... ] )

This function sets $var if it is not set with the last parameter or the first non-empty value.

Based on Alex Suraci's fallback() function. Updated for PHP 5.6.

Parameters

  • var — The variable to return or set.
  • ... — Another variable…

Return Values

Returns the value of whatever was chosen.

Examples

Example #1 fallback() example

function datetime($when = null) {
	fallback($when, time());
	$time = (is_numeric($when)) ? $when : strtotime($when) ;
	return date("Y-m-d", $time);
}

$nextWeek = time() + (7 * 24 * 60 * 60);

echo 'Now:       '. datetime() ."\n";
echo 'Next Week: '. datetime($nextWeek) ."\n";

The above example will output:

Now:       2005-03-30
Next Week: 2005-04-06

Installation

With Composer

$ composer require mcaskill/php-fallback

Without Composer

Why are you not using composer? Download Function.Fallback.php from the gist and save the file into your project path somewhere.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固