top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we redefine a constant in PHP?

+5 votes
1,302 views

In my script I have a requirement where I need to redefine a PHp constant is it possible do achieve?

posted Jan 16, 2014 by Salil Agrawal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

If you have the runkit extension installed, you can use runkit_constant_redefine():

runkit_constant_redefine("name", "value");
answer Jan 16, 2014 by Sheetal Chauhan
Thanks Sheetal it worked just one thing I need to do is to install runkit (sudo pecl install https://github.com/downloads/zenovich/runkit/runkit-1.0.3.tgz ) as it was not part of my PHP installation not sure why :(
...