Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using xdiff_string_diff

Status
Not open for further replies.

mufka

ISP
Dec 18, 2000
587
US
I'm trying to figure out a diff function in PHP. I want to compare one string to another and show the differences. I found and tried the following, but I get nothing from it.

Code:
<?php
$old_article = 'test 123';
$new_article = 'test 456';
$diff = xdiff_string_diff($old_article, $new_article, 1);
if (is_string($diff)) {
    echo "Differences between two articles:\n";
    echo $diff;
}

?>
 
silly question perhaps: have you installed xdiff? I believe that this must be done via PECL.
 
Not a silly question. I thought it was native. Is there a way to install it for Windows?
 
nope. not native.

and do you know... i have no idea how to use pecl on windows. i'd just try
Code:
pecl install --alldeps xdiff

it's possible that you could find the pre-compiled binaries for the extensions and just dl and enable them in php.ini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top