FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[php] Overwrite pre-made functions?





Stubru Freak
Is there a way to do this? So to overwrite a standard function like mysql_query() or rand() or mail() and change it into your own function, in your php script. Not really necessary, but would be handy. But I don't think there's a way.
polarBear
Although there's no point on doing that, you could always rewrite the DLLs where those functions live.
Simulator
Ok, why the hell would you want to do that, what is wrong with my_sql_query1 or something....
LukeakaDanish
The only possible use i can see of this would be that rewriting the php dlls would allow you to enter a contest for "the worlds most geeky nerd" Very Happy
clip
yes, there is a way. just like in C programming. modular programming used to use your own functions by replacing the header files like stdio.h . but on PHP, i believe overwriting them isnt a good idea. Why not make something that would add and not to overwrite?
Stubru Freak
For example, I once made a huge script, but a while later I wanted to change all times to gmt.

It would be handy to do

function date( ... ){
return gm_date( ... );
}

Instead of changing it everywhere

But rewriting the dlls isn't handy anymore...
PatTheGreat42
Instead of say, downloading all the PHP opensource code, changing it to your liking, and recompliling, wouldn't it be easier to say, use a "find and replace" function in any standard text editor?

Because it seems to me all you want to do is change the same thing about a bazillion times, and I think "find and replace" would do nicely.
Stubru Freak
PatTheGreat42 wrote:
Instead of say, downloading all the PHP opensource code, changing it to your liking, and recompliling, wouldn't it be easier to say, use a "find and replace" function in any standard text editor?

Because it seems to me all you want to do is change the same thing about a bazillion times, and I think "find and replace" would do nicely.


Yes, I did that.
But just wanted to know if there really is no other way.
Because, if you say to change date( into gm_date( and you typed gm_date( once instead of date, it changes it into gm_gm_date(
Of course it's solved in a few seconds but it's annoying.
Related topics
Some Pre-made sigs
image php sripting that made a image refreshed every loaded
RSS news ticker
AJAX tutorial [2nd part now updated]
PHP 5.x print functions ? [ printer ]
Simple (but not too simple) calendar in php
The best way to learn PHP?
Error messages and php editing in a photo archive (fixed?)
Help with php email
How to Enable PHP IMAP eMail Functions
Wow.
PHP OOP Tutorial
One heck of a nice idea
[PHP] phpbb registration - add to other db
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.