我需要一个函数,它的参数是一个对象,如果我将其保留为空,它将加载默认值。
就像是:
function loadMap(args) { //args is an object and its optional
//this is what I want to do, test args and load defauts if necesary
/*
pseudocode:
if args.latitude is not set then
give it a default value
if args.longitude is not set then
give it a default value
end pseudocode */
alert("Latitude is "+args.latitude );
alert("Longitude is "+args.longitude );
}
//outputs the default values
loadMap();
//outputs custom values
loadMap({latitude: "x.xxxx", longitude: "-x.xxxx"});
//and should work too and output …Run Code Online (Sandbox Code Playgroud) 这个问题显示了如何使用 SQL(SQL 日期格式从 INT(yyyymmdd) 类型转换为 date(mm/dd/yyyy)),我该如何使用 PHP 做到这一点?
我想将日期从 20141127 之类的日期转换为 2014-11-27,我不知道是否有内置函数,或者是否使用了 php 日期函数来实现这一点。
谢谢