Hey,
How can I cause a block of php code be executed once using a command like the include_once();If i use this directly it includes the contents of the include file like HTML content!
What can I do?:$

what block of code are you trying to execute?if php file then you can exclude your html content if you want to or better yet use functions.

hi
Could i see the code to give me an idea of what you need.

Thanks,
Actually I made my fuction inside a loop
I a certain case it should parse only once so I thought of using the include once to do this but It printed all the contents of the included file like plain html.
I dont have the code here since I'm working in a cyber

You can execute a block of PHP code in plain text directly. I would recommend taking a look at the eval() function, as that will allow you to do what your trying to do (as far as I know).

Inside the loop:

$executed = false;

if(!$executed) {

 //  Your block of code
 call_me_only_once();

 $executed = true;
}
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.