(View Original Web?)

HOBBY > COMPUTER SHARE

help PHP regex explode replace character dunk sob :D


<<  < (Page 3 of 3)
Quote from: admin_danny on September 13, 2011, 08:00:01 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
 

malah gini bang :

Notice: Undefined offset: 0
Quote from: okedol on September 13, 2011, 09:52:59 PM
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;
?>


 

<<  < (Page 3 of 3)

Navigation

Back Sub-Forum