- GoFuckBiz.info

  - GoFuckBiz.info > - > ,
, ,

27.04.2012, 12:36   #1
seroja
(..)
 
  seroja
 
: 23.11.2007
: 1,635
: $192265
 php!?

, , :
PHP ,

<a href="http://google.com/1">{search|images|maps|Calendar}</a>
<a href="http://google.com/2">{1|2|3|4}</a>
<a href="http://google.com/3">{A|B|C|D}</a>


{} ?

. - <a href="http://google.com/1">search</a> <a href="http://google.com/2">4</a> <a href="http://google.com/3">B</a>

- , 1 20.
__________________
ActionAds.ru - CPA ! | VPS 10$ ! | | [sale - 100$/month]
seroja   
27.04.2012, 12:56   #2
deschain
Senior Member
 
  deschain
 
: 01.11.2007
: 2,084
: $234635

PHP :
    $string '<a href="http://google.com/1">{search|images|maps|Calendar}</a>';
    
    echo 
spin_text($string);
    
    
    function 
spin_text($string) {
    
        if (
preg_match('/\{([^\}]*)\}/i'$string$random_words)) {
        
            
$random_words_array explode("|"$random_words[1]);
            if (
is_array($random_words_array)) {
                
shuffle($random_words_array);
                
$string preg_replace('/\{[^\}]*\}/i'$random_words_array[0], $string);
            }
        
        }    
    
        return 
$string;
    
    } 
deschain   
27.04.2012, 13:00   #3
seroja
(..)
 
  seroja
 
: 23.11.2007
: 1,635
: $192265

, 1 , .
.
__________________
ActionAds.ru - CPA ! | VPS 10$ ! | | [sale - 100$/month]

seroja; 27.04.2012 13:15.
seroja   
27.04.2012, 13:12   #4
deschain
Senior Member
 
  deschain
 
: 01.11.2007
: 2,084
: $234635

seroja, ,
deschain   
27.04.2012, 13:57   #5
primitive
 
: 04.08.2011
: 2
: $2555

PHP :
$content '<a href="http://google.com/1">{search|images|maps|Calendar}</a> <a href="http://google.com/2">{1|2|3|4}</a> <a href="http://google.com/3">{A|B|C|D}</a>';
function 
spinaround($content)
{
    
preg_match_all('/{(.*)}/sU',$content,$matches);
    foreach (
$matches[0] as $k=>$v)
    {
        
$string $matches[1][$k];
        if ( 
preg_match_all('/\[(.*)\]/sU',$string,$stringmatches) )
        {
            foreach (
$stringmatches[0] as $l=>$w)
            {
            
$new explode('|',$stringmatches[1][$l]);
            
$new $new[array_rand($new)];
            
$string str_replace($w,$new,$string);
            }
        }
        
$new explode('|',$string);
        
$new $new[array_rand($new)];
        
$content str_replace($v,$new,$content);
    }
return 
$content;
}

echo 
spinaround($content); 
primitive   
04.05.2012, 17:41   #6
vilnus
 
: 12.02.2010
: 24
: $4920

PHP :
$t "{||} {|}   {|}!";
echo 
$t preg_replace_callback("/\{([^{}]*?)\}/ism""callback"$t);

function 
callback($matches) {
  
$v preg_split("/(?<!\|)\|(?!\|)/"$matches[1]);
  return 
$v[array_rand($v)];

vilnus   
30.05.2012, 12:57   #7
TixiDrixi
 
: 19.03.2011
: 2
: $1210

:
vilnus
PHP :
$t "{||} {|}   {|}!";
echo 
$t preg_replace_callback("/\{([^{}]*?)\}/ism""callback"$t);

function 
callback($matches) {
  
$v preg_split("/(?<!\|)\|(?!\|)/"$matches[1]);
  return 
$v[array_rand($v)];

!
TixiDrixi   


© GoFuckBiz.info
Ad Management by RedTyger