PHP Round Up to nearest Array

//array list
$array = array(1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 150, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000);

//array round up function
function getArrayRoundUp($array, $number) {

foreach ($array as $a) {
if ($a >= $number) return $a;
return end($array);

//assume this is the value
$value = 904.5;

$nearest = getArrayRoundUp($array, $value);

//the expect result will be 1000
echo $nearest;


Laravel Valet for OpenCart 2.x using Custom Valet Drivers

Using Laravel Valet with OpenCart 2.x?

I am taking a while to understand how the valet custom driver work for my own OpenCart project.

1. My OpenCart project is located at ~/Sites/myshop (myshop is my folder name, it is very important how you name your driver)
2. Go to ~/.valet/Drivers/
3. Create a file name MyshopValetDriver.php
4. Template you can reference here. Laravel Valet for OpenCart 2.x
5. Tata, your Opencart now support SEO URL with Laravel Valet.


Valet Version: v2.0.5
Opencart Version: v2.3.0.2 (It will works on any Opencart 2.x version)


Vagrant Docker Windows 10 cannot ping from Host

If you notice after you restart your computer. Then you run vagrant up, and you can’t access to the vagrant image from the Windows 10 Vagrant Virtualbox with Docker Setup tutorial.

ping there are no response….

What you can do is follow the below step to reactivate again.

  1. SSH to the vagrant machine using
  2. sudo ip addr del dev enp0s8 remove the enp0s8
  3. sudo brctl addif docker1 enp0s8 bridge the network again
  4. Tata~ now you can ping from your host machine again
  5. Done. Continue your docker development.

Thank you for reading.

Laravel Valet enable xdebug with PHPStorm

Setting up Xdebug with Laravel Valet


Extra Note:

  1. Once you have upgraded new version of PHP, E.g PHP7.0 to PHP7.1. Remember install the xdebug package again.
  2. brew install php71-xdebug
  3. open file /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
  4. Added the following line after the zend_extension="/usr/local/opt/php71-xdebug/"

Last step run valet install to restart everything.