Skip to content

Instantly share code, notes, and snippets.

View ravahdati's full-sized avatar

Rasool Vahdati ravahdati

View GitHub Profile
@hamidrezayazdani
hamidrezayazdani / digits-wc-compatibility.php
Created October 12, 2021 23:42
هماهنگی افزونه دیجیتس با محصولات دانلودی ووکامرس
<?php
/**
* Sync wc with DIGITS plugin
*/
function ywp_sync_digits_with_wc( $customer_id, $new_customer_data, $password_generated ) {
$user = get_user_by( 'id', $customer_id );
if ( $user && property_exists( $user, 'user_email' ) && empty( $user->user_email ) ) {
$fake_mail = sprintf(
@carousel
carousel / snake-to-camel.php
Last active May 8, 2024 15:42
Convert snake to camel case and back with PHP
<?php
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
}