Skip to content

Instantly share code, notes, and snippets.

View vietnt-uet's full-sized avatar

Nguyen Trong Viet vietnt-uet

View GitHub Profile
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active August 6, 2024 16:43
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

Regular Expression Code

((\d{1,2}:)?[0-5]?\d:[0-5]?\d)((\s|'|||-|,|(PM|AM)|T))(((3[01]|[12][0-9]|0[1-9]|[1-9])|([0-9]{4}))(/|-||)(1[0-2]|0[1-9]|[1-9])(/|-)([0-9]{4}|(3[01]|[12][0-9]|0[1-9]))?)|((((3[01]|[12][0-9]|0[1-9]|[1-9])|([0-9]{4}))(/|-||)(1[0-2]|0[1-9]|[1-9]|\w{3})(/|-)([0-9]{1,4}|(3[01]|[12][0-9]|0[1-9])))(((\s|'|||-|,|T))((\d{1,2}:)?[0-5]?\d:[0-5]?\d[zZ]))?)

This is the Regular Expression that helps you match basic datetime formats before you bring it to the datetime format library. This is RE to help you, it's not 100% true different countries.

String -> RE -> Library format with strftime

I'm strftime