How do you fix undefined variable in Php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you fix undefined variable in Php

undefined variable or index

14th Jul 2017, 6:23 PM
Ricardo Chitagu
Ricardo Chitagu - avatar
2 Answers
+ 2
you have to define(initialize) it before you use it. It's a common error. Just initialize the variable with 0 or empty string before you use it further.
14th Jul 2017, 6:44 PM
Claudiu Stefan Haidu
Claudiu Stefan Haidu - avatar
+ 1
By giving the variable a value. Undefined variable means it does not equal anything. It has a null value. PS it would help if I could see the code.
14th Jul 2017, 6:46 PM
josh mizzi
josh mizzi - avatar