PHP to Python Code Differences - Arrays, Foreach Loops
<p>I hope this question is phrased appropriately to the policies of this site.</p>

<p>I am trying to convert a piece of Python Code to PHP code.  I have gotten almost every function translated except I cannot figure out how Arrays and Foreach loops are different in PHP vs Python. </p>

<pre><code>qstid = dbinputsurveyid+'X'+str(question.gid)+'X'+str(question.qid)
index=columns.index(qstid)
for i,a in enumerate(data[index]):
    if a!=None and a!='':
        answer=int(data[index][i])
        answerCodes=list(answersCode[question.qid])
        answerindex = answerCodes.index(str(answer))
        answerorder = answersOrder[question.qid][a]
        addAnswers(db, data[0][i], question.sid, question.gid, question.qid, question.type, answers[question.qid][answerindex], None,answerorder, None, None,None)
</code></pre>

<p>From some of the reading I have done. I think enumerate in python is the equivalent to a foreach loop in PHP. But im not sure how "i" and "a" come into play in the code above. They dont seem to be defined like you would in PHP.  Any help or insight is appreciated.</p>
