{"id":3878,"date":"2022-01-19T14:12:11","date_gmt":"2022-01-19T14:12:11","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=3878"},"modified":"2022-02-17T07:13:46","modified_gmt":"2022-02-17T07:13:46","slug":"positive-negative","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/maths\/positive-negative","title":{"rendered":"Positive \/ negative"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Get positive value<\/h4>\n\n\n\n<p>abs() function returns the absolute value of its number argument<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo abs(-12.239);   \/\/Prints: 12.34\r\necho abs(127);       \/\/Prints: 127<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Example returning the distance regardless of how the values are passed<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetDistance($Start, $End)\n{\n  return abs($Start - $End);\n}\n\nGetDistance(-1, 4)   \/\/Returns 5\nGetDistance(4, -1)   \/\/Returns 5\nGetDistance(3, 7)    \/\/Returns 4\nGetDistance(7, 3)    \/\/Returns 4<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Get positive value abs() function returns the absolute value of its number argument Example returning the distance regardless of how the values are passed<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[261],"tags":[],"class_list":["post-3878","post","type-post","status-publish","format-standard","hentry","category-maths"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3878","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=3878"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3878\/revisions"}],"predecessor-version":[{"id":3879,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3878\/revisions\/3879"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=3878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=3878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=3878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}