Note that there are some explanatory texts on larger screens.

plurals
  1. POLooking for help to sort out DIY array method in PhP
    primarykey
    data
    text
    <p>I need helps on the PhP array method deployed below:</p> <p>Actual PhP code:</p> <pre><code>$itemsB = array("Steve Jobs"=&gt;"USA", "Thomas Edison"=&gt;"USA"); echo $itemsB['Steve Jobs']; echo '&lt;br /&gt;'; echo $itemsB['Thomas Edison']; </code></pre> <p>Expected Result: USA USA</p> <hr> <p>Created DIY method below base on the above and hope to retrieve the same result but failed (getting no output)? The reason I am using this DIY method due to I have a list of Profile Data that need to fill into the conventional array method of : $items = array('name1'=>'value1', 'name2'=>'value2');</p> <pre><code>$ProfileName[0] = "\"Steve Jobs\"=&gt;\"USA\""; $ProfileName[1] = "\"Thomas Edison\"=&gt;\"USA\""; $items = array("$ProfileName[0]", "$ProfileName[1]"); echo $items['Steve Jobs']; echo '&lt;br /&gt;'; echo $items['Thomas Edison']; </code></pre> <p>Please advice! Cheers</p> <hr> <p>Alright, brief updates on what I am looking for if you still find unclear on the above. Below is the code to search Profile Name for autocomplete method on text field box. The code below is working if I entered the static values into the array. But, I have a list of Profile Names in the Database that I wanted to populate and add it into the array below. Thus, I thought of do some DIY that shown above. Unless there is other solution for this. Please advice</p> <pre><code>$q = strtolower($_GET["q"]); if (!$q) return; $items = array("Steve Jobs"=&gt;"USA", "Thomas Edison"=&gt;"USA"); foreach ($items as $key=&gt;$value) { if (strpos(strtolower($key), $q) !== false) { echo "$key|$value\n"; }//END IF }//END FOR </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload