Php Search Page that searches small non changing data structures stored locally in source code and returns with the result on another page


Hi All,

Sorry for the long title. I want to write a quick non changing search page with php.
That searches non changing very small data structures contained in the source code (not a database). Then returns to with the name of the structure on another page. In pseudo…

Data Structure in source code

structure_name_1 = {123,234,345}
structure_name_2 = {456,567,678}

Then have a html search box

input = "123"
Returns with new html page "123 is in structure_name_1"

input = "1254543"
Returns with new html page "1254543 was not found"

Thanks for any help!


What have you tried so far?


I have searched online for a solution that looks like my description and was unable to find anything. I just need to see an simple example in PHP where, the get request is born in search bar, and that get request is query against (at least two structures, as noted above. ) and returns with another page. I thought this would not be too complicated in php but may be mistaken? If this turns out to be a “big request” I might just roll up my solution in a database using python and flask. Thanks for any input.


The language isn’t the issue, it is the implementation.

You can add the array variables to a different array and search through them, but the question would be, why?

This is lacking understanding of a better way to do this I think. What are you trying to do, rather than how are you trying to do it?


I am not sure what you are asking me. I have explained what I am trying to do. Is there anything I was not clear about?


The issue is you want the variable name. Well, a variable is s temporary space in memory, not a reference. I posted a couple possibilities.