{"id":183,"date":"2012-01-31T20:23:43","date_gmt":"2012-01-31T20:23:43","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=183"},"modified":"2022-02-17T07:14:05","modified_gmt":"2022-02-17T07:14:05","slug":"functions-general","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/functions\/functions-general","title":{"rendered":".Functions General"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Function Examples<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetLongDate ($MyDateTime)\n{\n  return date(\"l F jS Y\", $MyDateTime);\n}\n\n\/\/Using it\n  echo GetLongDate (time());<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Functions with optional arguments<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>function MyFunction ($MyArgA, $MyArgB = 22, $MyArgC = \"My default value\")\n{\n\n}\n\n\/\/Using it\n  MyFunction(12);\n  MyFunction(12, 13);\n  MyFunction(12, 13, \"Hello\");<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">With a default array<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>function MyFunction ($MyArgA, $MyArgB = \narray() )\n{\n\n}\n\n\/\/Using it\n  MyFunction(12);\n  MyFunction(12, array(\n    'comments' => 0,\n    'responses' => 33\n    )\n  );\n\n\n\n\/\/Alternative way. and with a sub array added\n  MyFunction(12);\n  MyFunction(12, &#91;\n    'comments' => 0,\n    'responses' => 33,\n    'options' => &#91;\"min_range\" => 18, \"max_range\" => 124]\n    ]\n  );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Function Examples Functions with optional arguments With a default array<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-183","post","type-post","status-publish","format-standard","hentry","category-functions"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=183"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":4020,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/183\/revisions\/4020"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}