Lengkap

Edit my php script

I have a php script to list Anagrams of a word, all I need to do is add a word to the script and the out put will be a permutation of the word compared to the dictionary and then listed.

My problem is when I add some words the output is the same word repeated.

This happens whenever the word contains duplicate letters. When it swaps a letter with a copy of itself, such as the first and third letters in anagram, the new word is also in the dictionary, so it gets printed again.

Anagram gets printed 6 times, I’ve tried array_unique and many number of other things to remove duplicates.

What I need doing

==================

Edit the current code so it doesn’t echo duplicate words, should be a simple fix for someone in the know but I’m still new to php and can’t get my head around it.

CODE

<?php

function permute($str, $l, $r, $pspell_link)

{

if ($l == $r) {

if (pspell_check($pspell_link, $str)) {

echo "<p>".ucwords($str)."</p>";

};

}

else

{

for ($i = $l; $i <= $r; $i++)

{

$str = swap($str, $l, $i);

permute($str, $l + 1, $r, $pspell_link);

$str = swap($str, $l, $i);

}

}

}

function swap($a, $i, $j)

{

$temp;

$charArray = str_split($a);

$temp = $charArray[$i] ;

$charArray[$i] = $charArray[$j];

$charArray[$j] = $temp;

return implode($charArray);

}

$str = "anagram";

$n = strlen($str);

$pspell_link = pspell_new("en");

permute($str, 0, $n - 1, $pspell_link);

?>

Kemahiran: PHP

Lihat lagi: php script edit textfile, php script edit mysql, simple edit php mysql script, simple edit php script, php script edit data mysql dreamweaver, edit profile php script, php script handle large array, php script eliminate zero array, upload edit image php script, php mysql edit view script, csv php script edit pipe, php script edit table form, html mysql edit php script, php search edit mysql script, edit php script dreamweaver, image edit php script, code edit php script

Tentang Majikan:
( 28 ulasan ) chichester, United Kingdom

ID Projek: #21096068

Dianugerahkan kepada:

rsdsoftsl

hello. I see the problem and can fix it right now

£20 GBP dalam sehari
(335 Ulasan)
7.5

64 pekerja bebas membida secara purata £113 untuk pekerjaan ini

fattahaabdul

I can edit the script for you. I have 8+ years of experience in php. I assure you that i will give 100% quality work. Let us discuss and proceed further in chat. I am online. Please reply.

£135 GBP dalam 7 hari
(122 Ulasan)
8.0
kodecubeinfosys

Hello Sir, We are highly experienced in design and HTML along with Bootstrap. Css3, HTML5, photoshop are high experienced technologies. our experts are able to create and modify any type of website. our Lagi

£150 GBP dalam 7 hari
(149 Ulasan)
7.2
manifestinfo

Dear Client, Please invite me as I understand the requirement and can do this task easily. My portfolios: [login to view URL] Thanks & Regards Neelesh

£150 GBP dalam sehari
(25 Ulasan)
7.3
widadsaghir1993

Hello, thank you for your attention to me. I’ve read your description with care and I’m very interest in your project. I’ve rich experience in PHP. I want work with you. Regards.

£100 GBP dalam 7 hari
(88 Ulasan)
7.3
siddhu1986

Hi, I am an experienced Web Developer with years of experience in PHP/JS. I can update your code to remove duplicates. I have worked on various unique projects and have good experience in these kind of changes. I can Lagi

£25 GBP dalam sehari
(406 Ulasan)
7.3
bogahapitiya

⭐⭐⭐⭐⭐ Dear Client How are you? I have read your post and checked your requirements carefully. I can do it, I can start immediately and I will do my best to satisfy you. I have developed website for 15 years and I am se Lagi

£180 GBP dalam 7 hari
(49 Ulasan)
7.0
harrysart

Dear client, I have lots of experiences in the skills for your project. I hope to work for you because my skill set is very suitable for your project. I am confident to handle this project according to your expectation Lagi

£135 GBP dalam 2 hari
(129 Ulasan)
6.6
royalwebraisers

Dear Hiring Manager, I can help you in the project. We can IGNORE the repeating words by assigning in array. Please let me know when we can discuss in more details so that we could proceed further. Looking forward f Lagi

£50 GBP dalam 7 hari
(133 Ulasan)
6.6
bjrupani

Hello hiring member i am bhavika i have 4+years experience in php , laravel ,ajax , jquery javascript , html ,css , bootstrap i have done many php , project with my experience i can start this project right now , i ca Lagi

£80 GBP dalam sehari
(140 Ulasan)
6.6
devstart1234

Hi, How are you? I have checked requirement as well got your project scope and want to work with you, i have 5 year's great experience and able to do this work , Please share us existing site link and detail , i have Lagi

£135 GBP dalam 2 hari
(244 Ulasan)
7.0
Mickelson

Hello I can fix your php script in a short time. As you can see, I am a CERTIFIED PHP developer with enough experience. I can surely help you. Hope your kind contact Regards, Lian.

£135 GBP dalam sehari
(96 Ulasan)
6.7
engineersahab

Hello, I checked your requirement, i can help you to complete it on time. Please have a look at my recent completed works: [login to view URL] [login to view URL] [login to view URL] [login to view URL] Se Lagi

£135 GBP dalam 7 hari
(58 Ulasan)
6.9
caroldata

Hello, Greetings for the day!!!!! I have gone through the project requirement and would like to tell you that I have rich experience in PHP, HTML, CSS, MySQL, E-commerce, Software Architecture, WordPress, Magento, Lagi

£150 GBP dalam 7 hari
(52 Ulasan)
6.9
nisharapath

hello. how are you? I read your project and code and it is possile for me. as you can see in my profile, I have rich experiences in php. if you hire me, I will do my best and you will see good result. please contact m Lagi

£100 GBP dalam 2 hari
(32 Ulasan)
6.0
rahul668

Hi ~~~~~~~~~ READY TO START IMMEDIATELY ~~~~~~~~~~~~~ # I have Excellent experience working with SEO friendly , Mobile Responsive Websites # I WORK ON MANY DESIGNING COMPETITION WEBSITES . Here is my Portfolio. Af Lagi

£135 GBP dalam 7 hari
(23 Ulasan)
6.2
Alimughal786

Hi Sir, I have reviewed your job description as well & very confident to handle this project perfectly. I'm confident you will be happy with my job.I always have a clear focus on delivering results. I am expert in Web Lagi

£45 GBP dalam 7 hari
(63 Ulasan)
6.2
indiainfosoft

Dear Employer, This is Ajay here. I've reviewed your requirement and I'm ready to work with you. I will provide quality work as well full support for any query. I'm giving you trust for good quality work. I have almo Lagi

£40 GBP dalam sehari
(195 Ulasan)
6.4
aftabyounas

Hi I am software engineer and full stack PHP developer your project is looking very interesting and I am looking forward to your message

£35 GBP dalam sehari
(112 Ulasan)
6.4
tangramua

Hello! We can edit your PHP script. We are Ukrainian-Canadian team of highly professional Web developers and System Administrators with 19+ years expertise, specialized in web development, software development, design Lagi

£235 GBP dalam 2 hari
(28 Ulasan)
6.0
ArkssTech

Hi! My name is Vishal, I'm a Business Partner at ArkssTech, a Development Studio based in the India and We would like to help you with your project! What you are requesting HIRING dedicated Experts who will work on yo Lagi

£140 GBP dalam 7 hari
(39 Ulasan)
6.1