Jump to content

Recommended Posts

Hi there,

 

I'm learning PHP and decided that I'll try to create a word search generator for my own use. I know there are hundreds of them out there but it's just for learning purposes. I'd like to enter a number of words and then the script should generate a pdf containing a box filled with random letters (among which there will be my words). My question is what keywords/functions should I look at to get started? I'm a php beginner but would like to make my learning more interesting by doing this project.

 

The form with words should be easy, it's the next bit where it's supposed to generate a pdf containing words that I have no idea about.

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/245962-php-word-search-generator/
Share on other sites

I would forgo the PDF portion at this point and just make an HTML table with the letters. If you are learning, there is no need to over-complicate this. Once you can do that - then you can learn the process of making PDFs.

 

As for making the word search, that is an interesting problem. Trying to program the logic to dynamically determine the positions of the words will take some effort. You have to be able to get words to cross-over each other and share some letters. To do that would take some analysis of the words before you start, otherwise you may only get a handful of words in the grid and none of the remaining words would fit. The only suggestion I can think of would be to start with the longest words and work backwards.

 

I'm sure this is possible, but it is not a trivial task by any means. I would highly suggest that before you even start coding that you get out a piece of paper and write out the logic you want to use to determine placement of the words. If you can't come up with the logic, no amount of functions are going to help. If I were doing this I would probably use a multidimensional array to store the letters.

Thanks a lot for your replies. I'll look at the links.

On a separate note, I think you're right about thinking it over first before coding anything. The more I analyse it (with my limited knowledge of PHP and programming in general), the more I realise that I actually have no idea how to place those words on a grid among random letters.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.