• 0

Unset a function?


Question

Is there a way in PHP to unset/delete a function that's already been made, so that I can reuse the name?

Reason is because in vbulletin3.5 there's the plugin system which i want to use to edit a function but there's no hooks in that function,so what i want to do is just copy/paste the code, make my edits, and put it into a plugin that cmes after the function has been made. Problem with just creating it is that i get the function already exists cannot redeclare message.

Thanks. :)

Link to comment
https://www.neowin.net/forum/topic/392084-unset-a-function/
Share on other sites

10 answers to this question

Recommended Posts

  • 0
  kussie said:
Or just make your edits directly into the VB function

586756679[/snapback]

I'm trying to keep the forum file-edit free for ease of upgrading...

This is the only file edit the forum has atm, i'm just trying to make it into a plugin so there will be none to worry about.

  • 0
  nickg78 said:
You can use rename_function

<?php
rename_function('original_name', 'new_name' );
?>

and then redeclare the original function.

override_function may work too.

Info:

override_function

rename_function

586761508[/snapback]

I tried rename_function. Here is the code I used:

//Rename the old function
rename_function('strip_quotes','strip_quotes_non_nested');

But then I get this messsage on the forums:

Fatal error: Call to undefined function: rename_function() in /home/filesh/filesharingtalk.com/html/vb3/global.php(233) : eval()'d code on line 156

:(

  • 0

You might be able to use the method below, as described on: http://www.experts-exchange.com/Web/Web_La...Q_21615087.html

You can indeed call functions dynamically:

function function1(){
 echo "1";
}

function function2(){
 echo "2";
}

$i = "function2";
$i(); //  displays 2;

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • EMDB 5.38 by Razvan Serea EMDB is an application to keep track of your movie and TV Series collection. Both physical discs and media files are fully supported. With an automatic import from the database of IMDB, export to csv, text or HTML, thumbnail cover preview, a loan tracker, advances search and filter functions and multi-language user interface. EMDB doesn't need a .NET framework or any other external libraries and is therefore fully portable. And best of all... it's free!. EMDB 5.38 changelog: User interface: fix initial sort order was not always correct." Batch Update: fix updating TV Series from TheMovieDb cleared the title." Database: fixed possible invalid aspect ratio or codec could crash sorting." Search: added search on UPC / EAN." HTML Export: fixed favorites." Media files: delete / move thumbnails and subtitles too along with the media file." Image Import: added option to set resolution of saved images (when you use a zoomed bookshelf or display html on a 4K screen)." Batch update: movies in Collections were not always updated." Batch update: added an option to remove drive labels from media paths as they are not supported anymore and will break playing." HTML Export: fixed crash during export." Translations: updated the Arabic, Czech, French, German, Hebrew, Portuguese, Slovenian and Dutch translations." Download: EMDB 5.38 | 6.2 MB (Freeware) Link: EMDB Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • AMD brings datacenter-level AI to Windows PCs, runs Meta's 109B Llama lodel locally by Pradeep Viswanathan Earlier this year, during CES 2025, AMD announced the world's first AI PC processor that can run Meta's Llama 70B model locally. Today, AMD announced that the Ryzen AI MAX+ 395 processor, when paired with 128 GB of RAM on Windows, can now run Meta’s Llama 4 Scout 109B (17B active) with full vision and MCP support. This capability is enabled for the AMD Ryzen AI Max+ 395 processor with the new AMD Software: Adrenalin Edition 25.8.1 WHQL driver update. AMD claims that this processor can not only run Meta’s Llama 4 Scout but also supports a context length of 256,000 (Flash Attention ON, KV Cache Q8), which is useful for agentic workflows. AMD claims that the Llama 4 Scout 109B model was previously only possible on datacenter-grade hardware but is now available in thin and light PCs, thanks to its Variable Graphics Memory feature. Variable Graphics Memory is AMD's BIOS-level feature, introduced with the latest Ryzen AI 300 series processors, that enables users to reallocate a percentage of the system RAM to the integrated graphics. This unified memory architecture allows users to allocate unused system RAM as dedicated graphics memory. The AMD Ryzen AI Max+ processor is now available as an option for the following Windows PCs: ASUS ROG Flow Z13 Corsair AI Workstation 300 Framework Desktop HP ZBook Ultra G1a HP Z2 Mini G1a By enabling massive AI models to run locally, AMD is paving the way for more responsive, private, and capable AI applications on Windows PCs. As an Amazon Associate we earn from qualifying purchases.
    • You ARE old. Its not just a feeling.
    • Higher "Social Charges". I think that is a feel good phrase for 'Employee Deferred Compensation Charges". Then again, they use different wording in the "Old World." More precisely in American Accounting Lingo: "Mark to the Market Employee Differed Compensation Charges."
    • TikTok's "Add to Music App" feature gets support for another music streaming service by David Uzondu Image via Depositphotos.com TikTok's "Add to Music App" feature is getting support for another streaming service: YouTube Music. This comes a few months after the short-form video giant brought the feature to SoundCloud. "Add to Music App", if you have not heard of it, is a feature launched back in November 2023, initially for US and UK users, that makes saving music a lot easier. With this feature, users get an "Add Song" button next to the track name at the bottom of a TikTok video. When a customer first uses the feature, they can select their preferred streaming service from the available options, and this choice then becomes the default for all future one-tap saves (this can be changed anytime in the app's settings). The new YouTube Music integration means you can directly save the track to the streaming service with a single press. Users can also add a track from an artist's Sound Detail Page. When "Add to Music App" first appeared, the options were limited to Spotify and Amazon Music. Since then, TikTok has added Apple Music and Deezer. Each service gets a designated spot for the saved tracks, like Spotify's "Liked Songs" playlist. In YouTube Music's case, the song will land in a dedicated "TikTok Songs" playlist, so you do not have to go hunting for it later. TikTok claims that its "Add to Music App" function has resulted in over 1 billion saves globally since its wider rollout in 2024. On a related note, you probably are already aware of the current divest-or-ban issue TikTok's facing in the US. Howard Lutnick, the US Commerce secretary, recently stated in an interview with Fox News Sunday that President Trump loves the platform and sees it as "a good way to communicate with young people," but the platform's US operations must be handled by an American company, not Chinese.
  • Recent Achievements

    • Week One Done
      andeyhawk65 earned a badge
      Week One Done
    • First Post
      Jake2530 earned a badge
      First Post
    • Explorer
      Deranox went up a rank
      Explorer
    • Week One Done
      John Volks earned a badge
      Week One Done
    • One Month Later
      enric earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      675
    2. 2
      ATLien_0
      253
    3. 3
      Xenon
      177
    4. 4
      neufuse
      138
    5. 5
      +FloatingFatMan
      100
  • Tell a friend

    Love Neowin? Tell a friend!