Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_deep_replace [ WordPress Function ]

_deep_replace ( $search, $subject )
Access:
  • private
Parameters:
  • (string|array) $search
  • (string) $subject
Returns:
  • (string) The processed string
Defined at:



Perform a deep string replace operation to ensure the values in $search are no longer present

Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that str_replace would return

Source


<?php
function _deep_replace$search$subject ) {
    
$found true;
    
$subject = (string) $subject;
    while ( 
$found ) {
        
$found false;
        foreach ( (array) 
$search as $val ) {
            while ( 
strpos$subject$val ) !== false ) {
                
$found true;
                
$subject str_replace$val''$subject );
            }
        }
    }

    return 
$subject;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics