Thursday, September 25, 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
32320 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6683 POSTS0 COMMENTS
Nicole Veronica
11854 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11910 POSTS0 COMMENTS
Shaida Kate Naidoo
6795 POSTS0 COMMENTS
Ted Musemwa
7071 POSTS0 COMMENTS
Thapelo Manthata
6755 POSTS0 COMMENTS
Umr Jansen
6762 POSTS0 COMMENTS