Author: webhead

PHP – ‘anything’ in_array 0 is true

To my surprise an any array with value of 0 will cause the in_array function to be true. This is because PHP converts the string being compared to a number. ‘something’ == 0 is true because ‘something’ gets converted to

Tagged with:

WPEngine, Kinsta, or Cloudways – Which host is best?

Note:  I have websites hosted at WPEngine, Kinsta, AND Cloudways. Links to these hosts are affiliate links because I believe all these options are quality hosting companies. The Players First off, all hosts being compared here do managed hosting.  This

Tagged with: , , , , ,

Shorthand for array

Recently I jumped on a project that uses the shorthand to declare an array by using the brackets []. I wondered why I have been using “array()” this whole time besides it being common in WordPress. Only to realize after

Tagged with: ,

PHP 7.2 and the 502 error

My site was running fine and dandy for a few years.  I made the necessary adjustments to make it compatible with PHP 7.2 and upgraded the server.  A few days later I started receiving random 502 errors. The problem apparently

Tagged with: , ,

SVG as Background

When using an SVG as background with background-size: cover, the background would sometimes appear with a space on the left side.  Depending on the browser width it would be anywhere from 1px to 5px.   To solve this the SVG needs

Tagged with:

Print a trace of the call stack

In javascript you can print the call stack with something like this: from:

Tagged with:

Javascript Done Resize

Normally code in the resize event is meant to just run once when the user is done resizing.  This code below, from css-tricks and seen elsewhere will do the trick: var resizeTimer; $(window).on(‘resize’, function(e) { clearTimeout(resizeTimer); resizeTimer = setTimeout(function() {

Tagged with:

PHPUnit and PHP 7 problems

Problem I’m using PHPUnit 5.5, upgraded my PHP version to 7.2.  Two problems actually occur.  First there’s this weird error: Fatal error: Declaration of SebastianBergmann\Comparator\DOMNodeComparator::assertEquals… Then figuring PHPUnit needs to be upgraded, I ran phpunit –self-upgrade And that failed with

How to stop redirect from http:// to https:// in Chrome

Problem I’ve been trying like crazy to get to my local website at, but I keep getting redirected to and of course it doesn’t work because I don’t have a SSL certificate for that domain. Solution As of

Tagged with: ,

SVG height not scaling properly on IE 10

Problem IE 10 shows a skewed svg image who’s width is set to a specific value and height is auto.   Solution The problem is the width and height in the SVG file is set and IE is following those

Tagged with: ,