Declare the functions isbnFromText()
, isbn2Image()
and imagePix()
outside of getImg()
.
I don't know exactly how PHP handles functions that are declared inside another function, but apparently, it puts them into the same scope and if you run the outer function twice, they are declared again.
Example:
function a() {
function b() {
print 'foo';
}
b();
}
a();
a();
prints
foo
Fatal error: Cannot redeclare b() (previously declared in /t.php:4) on line 3
Update:
Learn more about functions, especially example 3. It is also stated there:
All functions and classes in PHP have the global scope - they can be called outside a function even if they were defined inside and vice versa.
PHP does not support function overloading, nor is it possible to undefine or redefine previously-declared functions.