Tips.PHP: A hidden gem in array_column

array_column can do much more than extracting a single column. Here is what you can do with array_column in PHP

By |September 10th, 2019|Blog, Code, Examples, PHP, Tips|0 Comments

Tips.PHP: Removing empty strings, NULL, FALSE, and negative numbers from Array

Often we need to remove empty elements from our array. For example when we split a string with space, we can get the words and also blank strings when there are two or more spaces put together.

We can use array_filter function for rescue. When we call array_filter with out passing the filter function it […]

By |September 14th, 2011|Blog, PHP, Tips|1 Comment

Tips.PHP: Securing ViewSource.php

I’m in the process of creating Usage examples for the brand new version of RESTler. Take a look at the work in progress version here (I would love to hear your thoughts). One of the nice features in that is the ability to see the source code.
I’m using a getsource.php which will return the […]

By |August 23rd, 2011|Blog, PHP, Tips|0 Comments

Removing Byte Order Mark (BOM) from the given string.

Since PHP does not recognize and ignore BOM in the loaded files, I wrote the following script to find and remove the BOM from the loaded string.

By |July 3rd, 2006|Blog, Code, PHP|0 Comments