Skip to content

Instantly share code, notes, and snippets.

View leealex's full-sized avatar
👨‍💻
Coding...

Alexey Lee leealex

👨‍💻
Coding...
View GitHub Profile
@swapnilshrikhande
swapnilshrikhande / function.php
Created April 26, 2016 10:08 — forked from YugalXD/function.php
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,
@wpscholar
wpscholar / array-insert-after.php
Created November 7, 2015 13:04
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@stemar
stemar / mb_substr_replace.php
Last active December 24, 2022 19:41
Multibyte substr_replace(). The mbstring library PHP < 7.x doesn’t come with a multibyte equivalent of substr_replace(). This function behaves exactly like substr_replace() even when the arguments are arrays.
<?php
function mb_substr_replace($string, $replacement, $start, $length=NULL) {
if (is_array($string)) {
$num = count($string);
// $replacement
$replacement = is_array($replacement) ? array_slice($replacement, 0, $num) : array_pad(array($replacement), $num, $replacement);
// $start
if (is_array($start)) {
$start = array_slice($start, 0, $num);
foreach ($start as $key => $value)