How To Interpret The Httpful\Response Object

Author: , December 10th, 2021

I use the httpful library from https://phphttpclient.com The website has not defined the Httpful\Response keys anyplace easy to find, so I have documented them here:

How To get_posts in WordPress with Multiple meta_query Values

Author: , October 13th, 2020

The first query gets all custom publication posts that have a value in field book_seq ordered by book_seq The second query gets all custom publication posts that have no meta value for book_seq or no meta record for key book_seq ordered by post_title.

Great article here: https://rudrastyh.com/wordpress/meta_query.html

How To Pretty Print JSON in PHP

Author: , June 11th, 2020

If you ever want to view your JSON as a human ;-} $pretty_json = json_encode($data, JSON_PRETTY_PRINT); https://www.php.net/manual/en/function.json-encode.php

How To Merge Object Variables in PHP

Author: , June 11th, 2020

$merged_object = (object) array_merge((array) $object1, (array) $object2);

How To Upgrade PHP on AWS Linux

Author: , August 22nd, 2019

As root:

~or~

THEN:

Be sure to restart your web server!!

How To Strip Windows Newlines in PHP

Author: , February 21st, 2018

$text = str_replace(“\r”, “”, $text);

How To Increase WordPress Memory After PHP Fatal error: Allowed memory size exhausted

Author: , February 13th, 2017

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 277644940 bytes) in /volumes/data/customer/wordpress/wp-content/plugins/searchwp/vendor/pdfparser/vendor/smalot/pdfparser/src/Smalot/PdfParser/Parser.php on line 72, referer: http://dev.thecustomer.com/index.php?swpnonce=1387006674.5392169952592578125000 To increase the PHP memory limit to 256MB, edit wp-config.php and add the following just before the line that says “That’s all, stop editing! Happy blogging.”:

How To Convert from mysql_ to mysqli_ in WordPress Plugins Easily

Author: , August 24th, 2016

As PHP deprecates old functions, sometimes code maintenance changes become required for long-running sites. As of PHP 5.5, the MySQL functions are deprecated and are removed in PHP 7! I recently had to convert multiple sites to mysqli PHP functions because a new server was running PHP 5.6 and the old server was on PHP […]

How To Convert UNIX Timestamps to Date using PHP CLI

Author: , August 15th, 2015

For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015”) – 1;’

How To Get SMF 2.0.6 to Open in a New Frame

Author: , October 23rd, 2013

The latest patch version of the SMF forum, 2.0.6, now prevents the site from opening up in an HTML frame. Simply comment out line 104 inside index.php: The Problem: $ grep -Rni X-Frame-Options * index.php:104: header(‘X-Frame-Options: SAMEORIGIN’); The Solution: //header(‘X-Frame-Options: SAMEORIGIN’);