php - Compare a function with another function -
i made function contain include file, can compare function other function ?
e.g.
in a.php
<?php $a = "this file"; ?>
in b.php
<?php $b = "this file"; ?>
in function.php
<?php function a(){ include("a.php"); } function b(){ include ("b.php"); } /* question can compare between function a() , function b() ? */ if(a()==b()){ echo "it's same words"; } else {echo "not same words";} ?>
i know there's simple way case, it's example, , want use way complicated algorithm.
regards.
nur haryadi
think way: when 2 functions equal? when results same parameters returns same values. means functions needs return something.
function a() { ob_start(); include("a.php"); return ob_get_clean(); } function b() { ob_start(); include("b.php"); return ob_get_clean(); } if (strcmp(a(), b()) == 0) { echo "it's same words"; }
Comments
Post a Comment