I'm editing someone else's code and I have a vague idea of what it does, but if anyone has seen this kind of thing and can explain it to me.

function mkdir_recursive($pathname, $mode)
	{
		is_dir(dirname($pathname)) | mkdir_recursive(dirname($pathname), $mode);
		return is_dir($pathname) || @mkdir($pathname, $mode);
	}

I don't understand why it's calling itself, and I know it's conditional execution but I can't figure out what to search for in the PHP manual. When I search for conditional execution it comes up with an entirely different subject.

The error it give is:

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 20 bytes) in /home/picfreez/public_html/upload_image.php on line 14

If I // the call to this function out it works just fine, but if a new user signs up they'll need this function(or something like it) working.

Help! :)

David

Recommended Answers

All 2 Replies

I hate it when code suddenly starts working.

Right after posting my question and without making any changes in the code it suddenly stopped giving me errors and started working flawlessly.

Thank you for the reply, if it gives problems again I'll just replace the code in the function with the proper code. :)

I'm not terribly impressed by the person who started this project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.