{"id":36,"date":"2005-05-30T21:54:54","date_gmt":"2005-05-30T20:54:54","guid":{"rendered":"http:\/\/pgregg.com\/wp\/2005\/05\/php-number-base-conversion-in-php\/"},"modified":"2013-05-28T23:35:35","modified_gmt":"2013-05-28T22:35:35","slug":"php-number-base-conversion-in-php","status":"publish","type":"post","link":"https:\/\/blog.pgregg.com\/blog\/2005\/05\/php-number-base-conversion-in-php\/","title":{"rendered":"PHP: Number base conversion in PHP."},"content":{"rendered":"<p>I thought I might &#8220;publicise&#8221; some of the code buried within this site.\u00a0 There are some useful things in here (even if I do say so myself) ;). And it would be a shame not to &#8216;blog&#8217; from the rooftops.\u00a0 Some of the code isn&#8217;t much use in the real world, but it serves its purpose of teaching both programming methods and how to do funky things in PHP.<\/p>\n<p>For first up, is arbitrary number base conversion in PHP.\u00a0 I know PHP has a built in base_convert() function, plus several other specific base conversion functions, e.g. decbin(), but I wanted to a) show <strong>how<\/strong> to do it, and b) implement one which could do bases 2-62 (default PHP ones does 2-36).<\/p>\n<p><a href=\"http:\/\/www.pgregg.com\/projects\/php\/base_conversion\/base_conversion.php\" target=\"_blank\" rel=\"nofollow\">http:\/\/www.pgregg.com\/projects\/php\/base_conversion\/base_conversion.php<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I thought I might &#8220;publicise&#8221; some of the code buried within this site.\u00a0 There are some useful things in here (even if I do say so myself) ;). And it would be a shame not to &#8216;blog&#8217; from the rooftops.\u00a0 Some of the code isn&#8217;t much use in the real world, but it serves its &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.pgregg.com\/blog\/2005\/05\/php-number-base-conversion-in-php\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PHP: Number base conversion in PHP.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-php"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbQOUu-A","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":1,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":532,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions\/532"}],"wp:attachment":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}