{"id":485,"date":"2018-05-04T20:59:23","date_gmt":"2018-05-04T18:59:23","guid":{"rendered":"http:\/\/www.apvnorge.no\/?page_id=485"},"modified":"2019-04-08T13:59:18","modified_gmt":"2019-04-08T11:59:18","slug":"developer-php","status":"publish","type":"page","link":"https:\/\/www.apvnorge.no\/no\/it-knowledge-base\/developer-php\/","title":{"rendered":"Developer PHP"},"content":{"rendered":"<div id=\"apvno-1394271435\" class=\"apvno-before-content apvno-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-7003427967427457\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:970px;height:250px;\" \ndata-ad-client=\"ca-pub-7003427967427457\" \ndata-ad-slot=\"6272152047\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"https:\/\/www.apvnorge.no\/it-knowledge-base\/\">Back to  IT Knowledge Base <\/a><\/strong><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<h2 data-index=\"0\" data-style=\"{\"><strong>Useful scripts and PHP features that are collected during application development<\/strong><\/h2>\n<h4 data-index=\"0\" data-style=\"{\"><strong>How to format file size<\/strong><\/h4>\n<pre>function formatBytes($size, $precision = 2)\n{\n$base = log($size, 1024);\n$suffixes = array('', 'K', 'M', 'G', 'T');\n\nreturn round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];\n}<\/pre>\n<hr \/>\n<h4><strong>How to format MAC Address<\/strong><\/h4>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">function AddSeparator($mac, $separator = ':')\n{\n$result2 = '';\nwhile (strlen($mac) &gt; 0)\n{\n$sub = substr($mac, 0, 2);\n$result2 .= $sub . $separator;\n$mac = substr($mac, 2, strlen($mac));\n}\n\n\/\/ remove trailing colon\n$result2 = substr($result2, 0, strlen($result2) - 1);\nreturn $result2;\n}\n<\/pre>\n<hr \/>\n<p>\u00a0<\/p>\n<\/div>\n<\/div>\n<\/div><div id=\"apvno-2560929426\" class=\"apvno-after apvno-entity-placement\"><script>\r\n_adsys_id = 33949;\r\n_adsys_size = 1;\r\n<\/script>\r\n<script src=\"https:\/\/d.wedosas.net\/d.js\"><\/script>    \r\n<\/br>\r\n<div>\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- AD-4 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:inline-block;width:970px;height:250px\"\r\n     data-ad-client=\"ca-pub-7003427967427457\"\r\n     data-ad-slot=\"6272152047\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div>\r\n<a href=\"https:\/\/affiliates.ssl.com\/820-3-1-13.html\" target=\"_blank\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" style=\"border:0px\" src=\"https:\/\/i0.wp.com\/affiliates.ssl.com\/media\/banners\/SSL-banner-UC-certificate-2-v5.png?resize=640%2C79&#038;ssl=1\" width=\"640\" height=\"79\" alt=\"Microsoft Exchange SAN UCC SSL\"><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>Back to IT Knowledge Base Useful scripts and PHP features that are collected during application development How to format file size function formatBytes($size, $precision = 2) { $base = log($size, 1024); $suffixes = array(&#8221;, &#8216;K&#8217;, &#8216;M&#8217;, &#8216;G&#8217;, &#8216;T&#8217;); return round(pow(1024, $base &#8211; floor($base)), $precision) .&#8217; &#8216;. $suffixes[floor($base)]; } How to format MAC Address function AddSeparator($mac, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":437,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-485","page","type-page","status-publish","hentry"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"no","enabled_languages":["en","no","cz"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"no":{"title":false,"content":false,"excerpt":false},"cz":{"title":false,"content":false,"excerpt":false}}},"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P9T0bk-7P","jetpack-related-posts":[],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/pages\/485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/comments?post=485"}],"version-history":[{"count":21,"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/pages\/485\/revisions"}],"predecessor-version":[{"id":1363,"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/pages\/485\/revisions\/1363"}],"up":[{"embeddable":true,"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/pages\/437"}],"wp:attachment":[{"href":"https:\/\/www.apvnorge.no\/no\/wp-json\/wp\/v2\/media?parent=485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}