Tuesday, February 3, 2026
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

1 COMMENT

Most Popular

Dominic
32478 POSTS0 COMMENTS
Milvus
124 POSTS0 COMMENTS
Nango Kala
6849 POSTS0 COMMENTS
Nicole Veronica
11980 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12066 POSTS0 COMMENTS
Shaida Kate Naidoo
6987 POSTS0 COMMENTS
Ted Musemwa
7222 POSTS0 COMMENTS
Thapelo Manthata
6935 POSTS0 COMMENTS
Umr Jansen
6919 POSTS0 COMMENTS