Say I have this array for example:
print_r($array);
Prints:
Code: [Select]Array
(
[0] => Array
(
[status] => 0
)
[1] => Array
(
[status] => 1
)
[1] => Array
(
[status] => 0
)
)
Now I have another array:
$color_array = array('0'=>'nocolor','1'=>'green');
How I can do the logic of this?
foreach($array as $tmp){
// Say status holds "1" in this case so it translate to
//$color_array[1]; = green
echo "{$color_array[$tmp['status']]}";
}
Obviously the above generate Illegal offset type. So I cant do that.
question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.I have roughly 30 files. I want to be able to edit every $_POST and $_GETCode:
Question about the upload of large files
Hi there,I have a question about the upload of large files, like videos (files generally above 20Mo).Is it better to use the FTP functions of php or the normal upload fonctions using additional
Insert to MySQL inside foreach
Hey.I am parsing some html, and putting inside an html db.I need to create a randomized integer to be a unique identifier, and i chose just to use time().But I foreach the results, and inside here i
RSS feed - FeedList for WordPress
Hi,I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of an item and have it open in a new window to display the full item. I don't want it to go to the host
DOMDocument parsing
Hello, I am parsing an xml file from an API which I have converted into a DOMDocument in php. This is mostly fine but one problem I have is when I do this:Code:
cURL Sending File as Post
This is a bit complicated, I'm just hoping someone else has run into this and knows how to do it a different way or make it work.When sending a file as part of form information included in a cURL
Validation
Hello I know this is a really vag question.I need to have a input field on a form that only submit's if the text inserted starts with any two letters and any four numbers
Filtering an Array Based on Value
I have a very simple script set up that pulls data from a database and is output using this code:Code: Print "<table border cellpadding=3>";Print
Email Processor
I have a few questions so this post will be a larger one! Sorry, but I'm a bit of a PHP newbie so be gentle with me! Awhile back I wrote out a simple forum to email processor that I used with a few
$_GET problem
Hi all,Have a bit of a problem with a little piece of code, I am not sure if this should be under php or ajax as I am not sure where the problem lies. Basically here is the script:Code: