You Now Here »

help PHP regex explode replace character dunk sob :D  (Read 9185 times)

okedol

  • More Share Forum Topic
  • [MS] pendatang baru
  • *
  • okedol kurang gaul.
  • Rep Power: 0
  • Join: June 30, 2011
  • Posts: 8
  • Poin: 2
  • IP member tracker Logged
Re: help PHP regex explode replace character dunk sob :D
« Reply #10 on: September 13, 2011, 09:52:59 PM »


ini mungkin

$filter 'http';
preg_match("/".$filter."/"$text$matches);
if (
$filter == $matches[0]) 
{
$text 'hay';
}


misal ketemu karakter 'http'
maka variable $text akan kereplace menjadi hay
  :beer:

malah gini bang :

Notice: Undefined offset: 0

DANNY

G-Plus Author
  • ADMINISTRATOR
  • More Share Forum Topic
  • [MS] kepala suku
  • *
  • DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!
  • Rep Power: 6
  • Join: September 30, 2009
  • Posts: 11,931
  • Poin: 193.939
    • WWW
  • IP member tracker Logged
Re: help PHP regex explode replace character dunk sob :D
« Reply #11 on: September 14, 2011, 12:00:22 AM »
malah gini bang :

Notice: Undefined offset: 0

lancar sob ane test...
salah variable nya kali ente nih coba jalanin langsung


<?php
$text 
'http://www.jdkjsbkjfbsd.com hahahaha';

$filter 'http';
preg_match("/".$filter."/"$text$matches);
if (
$filter == $matches[0]) 
{
$text 'hay';
}

echo 
$text;
?>


  :ehm