Jump to content
Sign in to follow this  
jesseclane

preg_match dlm php

Recommended Posts

$text = "<td width='15%'>Nerve:</td><td width='35%'>2 / 8 [25%]</td>"

soklan

cmne nk dptkan value 2 (yang diboldkan) tu? xpandai lagi dengan preg_match.. jauh sangat dengan Nerve: tuh.. huhu..

sapa2 leh tlg.. tQ!

Share this post


Link to post
Share on other sites
Kenapa pilih nak guna preg_match? Memang akan sentiasa cari nilai 2 ke?

Share this post


Link to post
Share on other sites
Code:
<?php

$text = "<td width='15%'>Nerve:</td><td width='35%'>2 / 8 [25%]</td>";

if((preg_match("/<td width='35%'>(.*?)<\/td>/", $text, $result))) {
   echo $result[0];
} else {
   echo "Text tidak dapat di cari!";
}


?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...