Monday, 12 September 2016

PHP 7.0 ZendDebugger.so for 64bit Linux

It's really hard to find ZendDebugger.so for php7.0 linux, but here it is:


ZendDebugger.so PHP7.0

; Specifies the hosts that are allowed to connect (hostmask list) with Zend Debugger when running a remote debug session with Zend Studio
zend_debugger.allow_hosts=127.0.0.0/8,<YOUR IP ADDRESS>

; Specifies the hosts that are not allowed to connect (hostmask list) with the Zend Debugger when running a remote debug session with Zend Studio
zend_debugger.deny_hosts=

; A list of hosts (hostmask list) that can use the machine on which Zend Server is installed to create a communication tunnel for remote debgging with Zend Studio. This is done to solve firewall connectivity limitations
zend_debugger.allow_tunnel=

; The user ID of the httpd process that runs the Zend Debugger (only for tunneling)
zend_debugger.httpd_uid=-1

; A range of ports that the communication tunnel can use. This defines the minimum value for the range
zend_debugger.tunnel_min_port=1024

; A range of ports that the communication tunnel can use. This defines the maximum value for the range
zend_debugger.tunnel_max_port=65535

; Define whether to expose the presence of the Zend Debugger to remote clients
zend_debugger.expose_remotely=2

; The Debugger's timeout period (in seconds) to wait for a response from the client (Zend Studio) (units: seconds)
zend_debugger.passive_mode_timeout=20

; Enables fast time sampling which is dependent on CPU cycles and frequency, otherwise, the directive uses operating system timing (which may be less accurate)
zend_debugger.use_fast_timestamp=1

; Enable code-coverage feature, should only be true on local debugger
zend_debugger.enable_coverage=1

zend_debugger.xdebug_compatible_coverage=0

Zend debugger php 7 settings

Tuesday, 26 July 2016

How to decode encoded html entities in javascript:

<?php

/**
* Decode a string with encoded characters like &amp;
* @param string encodedString - string to encode
* @return string
*/
function decodeEntities(encodedString) {
  var textArea = document.createElement('textarea');
  textArea.innerHTML = encodedString;
  return textArea.value;
}

console.log(decodeEntities("Keith & Hards"));

output: "Keith & Hards"




 

Wednesday, 20 July 2016

Passing JSON into php function as a parameter

Here is an example of hot to pass JSON into a php function as a parameter:

<?php

function print_details($json) {
 $args = json_decode($json);
 
 echo "My first name is {$args->first_name}<br />"; 
 echo "My last name is {$args->last_name}<br />"; 
 echo "My age is {$args->age}<br />";  
}


print_details('{
  "first_name": "keith",
  "last_name": "hards",
  "age": 37
}');
 

Wednesday, 6 July 2016

Linux:
How to find where your disk space has gone:

du -h --max-depth=4 | sort -hr


Though these days I tend to use ncdh which is perfect.

Thursday, 5 May 2016

Some examples of using PHP CURL under various circumstances including cookies and callback's

https://curl.haxx.se/libcurl/php/examples/callbacks.html