LiDoNg_9_0's Profile User Rating: -----

Reputation: 10 Tradesman
Group:
Active Members
Active Posts:
160 (0.09 per day)
Joined:
03-September 09
Profile Views:
4,060
Last Active:
User is offline Aug 21 2012 09:05 AM
Currently:
Offline

Previous Fields

Country:
PL
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Nissan
Dream Kudos:
0

Latest Visitors

Icon   LiDoNg_9_0 I have no status

Posts I've Made

  1. In Topic: Sentence difference algorithm

    Posted 17 Aug 2012

    View PostCTphpnwb, on 17 August 2012 - 07:44 AM, said:

    You need to iterate through the arrays manually. Something like this:
    $s1="grey tiles 100 X 200 kitchen flooring";
    $s2="grey tiles 200 X 600 kitchen flooring";
    $sa1=explode(" ",$s1);
    $sa2=explode(" ",$s2);
    if(count($sa1) < count($sa2)) {
    	$difference = compare_arrays($sa2,$sa1);
    } else {
    	$difference = compare_arrays($sa1,$sa2);
    }
    echo "The Difference =<br>".$difference;
    
    function compare_arrays(&$larger, &$smaller) {
    	$n = count($smaller);
    	$diff = "";
    	for($i = 0; $i < $n; $i++) {
    		if($larger[$i] != $smaller[$i]) {
    			$diff .= $larger[$i]." vs ".$smaller[$i]."<br>";
    		}
    	}
    	$n = count($larger);
    	while($i < $n) {
    		if($larger[$i] != $smaller[$i]) {
    			$diff .= $larger[$i]." vs ".$smaller[$i]."<br>";
    		}
    		$i++;
    	}
    	return $diff;
    }
    


    wtf, i've been working to this for the whole day and when I post here it was just like 30 mins or something, somebody just got it right. Your amazing dude. Thanks I appreciate your help. :)
  2. In Topic: string slicing / string manipulation

    Posted 17 Jul 2012

    View PostAstalor, on 17 July 2012 - 09:07 AM, said:

    Hello there!

    For the task you have mentioned I would suggest looking into using regular expressions, below are some useful links to look at.

    PREG functions in PHP (in particular hit up preg_match)
    http://www.php.net/m...en/ref.pcre.php

    A cheat sheet for regular expressions
    http://www.cheatogra...ar-expressions/


    Thank you astalor.
    I already solved this issue using regular expression. I appreciated your help.

My Information

Member Title:
D.I.C Head
Age:
23 years old
Birthday:
September 9, 1990
Gender:
Location:
Philippines
Interests:
Programming
Full Name:
Sunny Jay Sabuero
Years Programming:
3
Programming Languages:
PHP, VB 6, C/C++

Contact Information

E-mail:
Private
Yahoo:
Yahoo  LiDoNg_9_0@yahoo.com

Friends

Comments

Page 1 of 1
  1. Photo

    LiDoNg_9_0 Icon

    13 May 2010 - 18:17
    happy programming guys..
Page 1 of 1