Wednesday, 13 November 2019

Regex

Menghilangkan semua tag <br> atau <br/> di akhir kalimat.

$html = "Hello World <br>  <br> </br>";
echo preg_replace('#(<br */?>[^a-zA-Z1-2]*\s*){1,}$#i', '', $html));

Sunday, 7 April 2019

Mengelola Berbagai Versi PHP

Untuk menggunakan berbagai versi PHP kita bisa menggunakan phpenv, tapi entah kenapa, jika di Mac phpenv ini lambat. Sebagai alternatif, untuk lingkungan Mac, kita bisa menggunakan tips yang dijelaskan di [2], jika ingin mengubah versi PHP yang digunakan, kita dapat menjalankan perintah :

phpv 7.4


Untuk instalasi di Mac : 

 

brew tap shivammathur/php

brew install shivammathur/php/php@5.6

brew install shivammathur/php/php@7.0

brew install shivammathur/php/php@7.1

brew install shivammathur/php/php@7.2

brew install shivammathur/php/php@7.3

brew install shivammathur/php/php@7.4

brew install shivammathur/php/php@8.0


brew services start shivammathur/php/php@5.6

brew services start shivammathur/php/php@7.0

brew services start shivammathur/php/php@7.1

brew services start shivammathur/php/php@7.2

brew services start shivammathur/php/php@7.3

brew services start shivammathur/php/php@7.4

brew services start shivammathur/php/php



 

Referensi

  1. phpenv, Simple PHP version management, https://github.com/phpenv/phpenv
  2. macOS 11 Big Sur Nginx Setup: Multiple PHP Versions, https://kevdees.com/macos-11-big-sur-nginx-setup-multiple-php-versions/

Saturday, 30 March 2019

Monday, 7 January 2019

PHP - MySQL 8.0

Error : PHP message: PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password]


https://stackoverflow.com/questions/50026939/php-mysqli-connect-authentication-method-unknown-to-the-client-caching-sha2-pa