Thursday, June 11, 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

2 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS