The Official Blog of Richard Ricketts

my personal knowledge base


How to Add an Auto Incrementing Number to Each Selection in Sublime Text 3

Posted by on 1:23 pm in Other | 0 comments

1. Open Sublime Text 3 2. Make sure you have Package Control installed ( 3. Press CTRL + SHIFT + P 4. Type Install onto the dialog window 5. Select “Package Control: Install Package” and press “Enter” 6. Search for and install “Increment Selection” 7. Select 2+ lines using “ctrl” + “left mouse click” this this this this 8. Then press “ctrl” + “alt” + “i” 9. Boom, it will auto-increment each line 1,2,3,4 etc....

read more

How to Format a Money Amount Using PHP

Posted by on 6:04 pm in Tutorials | 0 comments

$number = 1234.56; setlocale(LC_MONETARY, ‘en_US’); echo money_format(‘%i’, $number) . “\n”; This will output: USD 1,234.56 $number = 1234.56; setlocale(LC_MONETARY, ‘en_US’); echo money_format(‘$%!n’, $number) . “\n”; This will output: $1,234.56

read more

How to Format a Phone Number Properly Using PHP

Posted by on 5:58 pm in Tutorials | 0 comments

Let’s say your phone number is: 000-111-2222 And the way you have the phone number in your database is: 0001112222 Run this command on the $variable: $phone_number = 0001112222 preg_replace(‘/\d{3}/’, ‘$0-‘, str_replace(‘.’, null, trim($phone_number)), 2); This will format your phone number, just like so: 0001112222 -> 000-111-2222

read more