What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-27 18:15:07
repalce 0 in phone with 234
echo preg_replace('/0/', '234', '08183780409', 1); Add solution -
PHP 2022-02-25 03:15:09
wp varnish ip
//Add at the top of wp-config.php $temp_ip = explode(',', isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : (isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : $_SERVER['REMOTE_ADDR'])); $remote_addr = trim($temp_... Add solution -
PHP 2022-02-24 15:40:03
php function to convert string to camelcase
public static function camelCase($str, array $noStrip = []) { // non-alpha and non-numeric characters become spaces $str = preg_replace('/[^a-z0-9' . implode("", $noStrip) . ']+/i', ' ', $str); $str = trim($str); ... Add solution -
PHP 2022-02-16 19:30:05
image upload and get attachment id in wordpress
/* this function for upload image in wordpress and return attchement id code by joshi yogesh ([email protected])*/ function cst_image_upload($img){ require_once( ABSPATH . 'wp-admin/includes/image.php' ); $attes_id = array(); $cnt = c... Add solution -
PHP 2022-02-13 17:50:10
auto generate table of contents php
<?php function TableOfContents($depth) /*AutoTOC function written by Alex Freeman * Released under CC-by-sa 3.0 license * http://www.10stripe.com/ */ { $filename = __FILE__; //read in the file $file = fopen($filename,"r"); $html_str... Add solution -
Other 2022-02-12 13:05:08
preg_replace examples
$result = preg_replace('/abc/', 'def', $string); # Replace all 'abc' with 'def' $result = preg_replace('/abc/i', 'def', $string); # Replace with case insensitive matching $result = preg_replace('/\s+/', '', $string); # Strip all whitespaces Add solution