Thursday, September 4, 2025
HomeLanguagesPHP output_reset_rewrite_vars() Function

PHP output_reset_rewrite_vars() Function

The output_reset_rewrite_vars() is a built-in function in PHP, resets URL rewriter values by removing all rewrite variables previously set through the output_add_rewrite_var() function.

Syntax:

output_reset_rewrite_vars(): bool

Parameter: This function does not accept any parameters.

Return Values: This function returns “true” if successful otherwise it will return “false”.

Program 1: The following is the Illustration of the ouput_reset_rewrite_vars() function.

PHP




<?php
ini_set('url_rewriter.tags', 'a=href,form=');
output_add_rewrite_var('page', 'home');
echo '<a href="index.php">Home</a>';
output_reset_rewrite_vars();   
?>


Output:

Home   

Program 2: The following is the Illustration of the output_reset_rewrite_vars() function.

PHP




<?php
// Make the URL rewriter affect <a href> and <form> tags
ini_set('url_rewriter.tags','a=href,form=');
  
// Add a variable
output_add_rewrite_var('var', 'value');
echo '<a href="">This link (URL) will have a variable</a><br>';
ob_flush();
  
// Remove the variable
output_reset_rewrite_vars();
echo '<a href="">This link (URL) will not have a variable</a>';    
?>


Output:

This link (URL) will have a variable
This link (URL) will not have a variable

Reference: https://www.php.net/manual/en/function.output-reset-rewrite-vars.php

RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11797 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6715 POSTS0 COMMENTS