{"id":28850,"date":"2018-10-10T09:12:21","date_gmt":"2018-10-10T07:12:21","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28850"},"modified":"2018-10-10T09:12:21","modified_gmt":"2018-10-10T07:12:21","slug":"bitmask-constant-arguments-in-php","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/10\/bitmask-constant-arguments-in-php\/","title":{"rendered":"Bitmask Constant Arguments in PHP"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p><a href=\"https:\/\/medium.com\/@liamhammett\">Liam Hammett<\/a>\u00a0(check many of his other excellent posts) has a nice explanation of the <a href=\"https:\/\/medium.com\/@liamhammett\/bitmask-constant-arguments-in-php-cf32bf35c73\">bitmask constant arguments in PHP<\/a>.\u00a0 These are fairly common and most PHP developers have seen them.\u00a0 However, it&#8217;s been a few occasions where I discovered that especially newer developers don&#8217;t understand how this works.<\/p>\n<p>Bitmask arguments and operations were used extensively in programming by the older generations, especially where CPU and memory were critical.\u00a0 But with hardware getting so much cheaper over the last few decades, nobody really cares about an extra few memory bytes and CPU cycles.<\/p>\n<p>Regardless of the memory and CPU though, bitmask arguments are still quite handy and using them can significantly simplify the code.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Liam Hammett\u00a0(check many of his other excellent posts) has a nice explanation of the bitmask constant arguments in PHP.\u00a0 These are fairly common and most PHP developers have seen them.\u00a0 However, it&#8217;s been a few occasions where I discovered that especially newer developers don&#8217;t understand how this works. Bitmask arguments and operations were used extensively &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/10\/bitmask-constant-arguments-in-php\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Bitmask Constant Arguments in PHP<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[38,1330],"keyring_services":[],"class_list":["post-28850","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-php","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":27612,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/05\/23\/php-moving-from-array-to-class\/","url_meta":{"origin":28850,"position":0},"title":"PHP : Moving from array to class","author":"Leonid Mamchenkov","date":"May 23, 2017","format":false,"excerpt":"\"Moving from array to class\" is yet another thought-provoking take on the difference between arrays and classes in the modern versions of PHP. \u00a0The benefits of moving from arrays to classes seem to be not only in the code readability and maintainability, but quite clearly in performance and resource utilization\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28276,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/11\/php-fpm-tuning-using-pm-static-for-max-performance\/","url_meta":{"origin":28850,"position":1},"title":"PHP-FPM tuning: Using \u2018pm static\u2019 for Max Performance","author":"Leonid Mamchenkov","date":"December 11, 2017","format":false,"excerpt":"\"PHP-FPM tuning: Using \u2018pm static\u2019 for Max Performance\" looks at different process management settings in PHP-FPM: static, dynamic, and ondemand, and the way they affect performance.\u00a0 The default - ondemand - might work well for you if you have a large server with plenty of resources and not so many\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27463,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/27\/creating-strictly-typed-arrays-collections-php\/","url_meta":{"origin":28850,"position":2},"title":"Creating Strictly Typed Arrays and Collections in PHP","author":"Leonid Mamchenkov","date":"March 27, 2017","format":false,"excerpt":"This SitePoint PHP blog post\u00a0(read at Planet PHP if the site is unavailable) brings to light a very useful feature available since PHP 5.6 - ellipses in functional arguments, which allows to define a variable number of arguments to a function. I've seen the mentions of ellipses a few times\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":43022,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/08\/21\/php-vs-p\/","url_meta":{"origin":28850,"position":3},"title":"PHP vs P++","author":"Leonid Mamchenkov","date":"August 21, 2019","format":false,"excerpt":"If you haven't heard the news yet and are wondering what the heck P++ is, here's a quick update for you. There's been some noise around the idea of creating a separate dialect of PHP, code-named P++. The idea is an attempt to find a compromise between two different schools\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21799,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/05\/13\/phpng-dramatic-speedup-features-coming-in-php-6-release\/","url_meta":{"origin":28850,"position":4},"title":"PHPNG Dramatic Speedup Features Coming in PHP 6 Release","author":"Leonid Mamchenkov","date":"May 13, 2014","format":"link","excerpt":"PHPNG Dramatic Speedup Features Coming in PHP 6 Release Some highlights: The plot to kill Apache mod_php SAPI Type hinting for everything (function arguments, function return values, and variables) Asynchronous programming (using the new await keyword) Production ready standalone web server Multi-thread safe","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27105,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/12\/11\/php-static-analysis-tool-discover-bugs-in-your-code-without-running-it\/","url_meta":{"origin":28850,"position":5},"title":"PHP Static Analysis Tool &#8211; discover bugs in your code without running it!","author":"Leonid Mamchenkov","date":"December 11, 2016","format":false,"excerpt":"Ond\u0159ej Mirtes shares the idea behind the creation of\u00a0PHPStan - a static analysis tool for PHP: Compiled languages need to know about the type of every variable, return type of every method etc. before the program runs. This is why the compiler needs to make sure that the program is\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28850"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28850\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28850"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}