how to convert variable from string to number

lf14web 14 Jun, 2018
Hi,
The result of this query I get a number: 11325

I can not to do a operation mathematic with this number because the system read this value how a string.

I tried to convert this variable to number whitout success and I obtaim always 0:
<?php

$num='{var:read_data26}';
//$dtc -= 7;
$int = (int)$num;
$float = (float)$num;
$intval = intval($num);

echo $num."///" ;
echo $intval."///" ;
echo $int."///" ;
echo $float ;

?>

Result:

11325///0///0///0

How I can to use this data how number?
Thanks
Emanuele
Array
(
    [_ga] => GA1.2.371091234.1528460153
    [adcf749bbd5f64903947be2e21155320] => 6tl20k36bpmc4fnaml0sijl312
    [78f1bfe75faa4fc86eec21112d3f6c0e] => uqrvdq3qi8uunm4v8ooabui7i7
    [Itemid] => 117
    [option] => com_chronoforms6
    [view] => form
)
Array
(
    [read_data26] => Array
        (
            [log] => Array
                (
                    [0] => SELECT COUNT(`contatabella`.`aid`) AS `contatabella.count` FROM `u53uf_chronoforms_data_rilievi-idrometrici-laghi` AS `contatabella` LIMIT 100;
                )

            [var] => 11325
        )

)
GreyHead 15 Jun, 2018
Hi If14web,

Please try removing the quotes from the first line:
$num = {var:read_data26};
Bob

Later: Sorry, this is not correct - please see healyhatman's later post.
lf14web 15 Jun, 2018
Hi Bob,
I've already tried, but doesn't work.
:-(
healyhatman 15 Jun, 2018
Answer
You can't use a shortcode in php code. Replace it with $num = $this->get("read_data26", "");
This topic is locked and no more replies can be posted.