php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7156 equal datatypes and equal values not response in if structure
Submitted: 2000-10-12 09:02 UTC Modified: 2000-11-19 12:18 UTC
From: hboveri at bancobisel dot com dot ar Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.3 OS: solaris 2.7
Private report: No CVE-ID: None
 [2000-10-12 09:02 UTC] hboveri at bancobisel dot com dot ar
<?
// *******************
// Inicializo el ERROR
// *******************
$MSG_ERROR = "";

$cuota           = 10;
$cuota_hasta     = 12;
$Cobranza        = "656.81";
$gHonorarios     = 10;
$gcuota_vencida  = "N";

        $rec_cli_suc_cod        = "rec_cli_suc_cod";
        $rec_cli_nro_cli        = "rec_cli_nro_cli";
        $rec_cli_desc_cli       = "rec_cli_desc_cli";
        $rec_lin_codigo         = "rec_lin_codigo";
        $rec_lin_desc_lin       = "rec_lin_desc_lin";
        $rec_cuo_fec_vto        = "rec_cuo_fec_vto";
        $rec_pre_nro_sol        = "rec_pre_nro_sol";
        $rec_pre_suc_res        = "rec_pre_suc_res";

        $a_cobrar[1]            = "596.68";
        $a_cobrar[2]            = "0.35";
        $a_cobrar[3]            = "0.07";
        $a_cobrar[4]            = "0.0";
        $a_cobrar[5]            = "0.0";
        $a_cobrar[6]            = "0.0";
        $a_cobrar[7]            = "0.0";
        $a_cobrar[8]            = "0.0";
        $a_cobrar[9]            = "0.0";
        $a_cobrar[10]           = "0.0";

// ****************************************
// Calculo el Total a Pagar de la CUOTA
// ****************************************
$SubTotal = 0.0;
for( $i = 1; $i <= 10; $i++ ){
    $SubTotal += $a_cobrar[$i];
}

echo gettype($SubTotal) . "  ($SubTotal) SubTotal <br>";

// **********************
// Calculo los honorarios
// **********************

$total_honorarios = 0.0;
$total_honorarios = $SubTotal * $gHonorarios / 100.0;

echo gettype($total_honorarios) . "  ($total_honorarios) total_honorarios <br>";

// ************************
// Acumulo al Total a Pagar
// ************************

$total_a_pagar = 0;
echo( "subtotal,total_honorarios: $SubTotal + $total_honorarios<br>" );
$total_a_pagar = $SubTotal + $total_honorarios;

echo strlen($total_a_pagar) . "  " . gettype($total_a_pagar) . "  ($total_a_pagar) total_a_pagar <br>";
echo strlen($Cobranza)      . "  " . gettype($Cobranza)      . "  ($Cobranza) Cobranza <br>";

settype( $Cobranza, "double" );

echo strlen($total_a_pagar) . "  " . gettype($total_a_pagar) . "  ($total_a_pagar) total_a_pagar <br>";
echo strlen($Cobranza)      . "  " . gettype($Cobranza)      . "  ($Cobranza) Cobranza <br>";

// --------------------------------------------------------------------
// this is the cuestion !!!
if( $Cobranza >= $total_a_pagar ) {
// --------------------------------------------------------------------

   echo "<br>ok";

} else {

   echo "<br>error";
}

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-18 05:55 UTC] stas@php.net
Could you please explain in detail what's the problem and cut down you code to the minimal size which reproduces the problem?
 [2000-11-19 12:18 UTC] stas@php.net
no feedback
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 11 02:01:24 2020 UTC