Im facing problem in assigning value of eval array variable as normal variable..
x=0
eval DATA${x}="FJSVcpcu"
x=`expr $x + 1`
eval DATA${x}="FJSVcsr"
if x=0, type -> eval echo \$DATA$x , its give me FJSVcpcu
i want assign this value into an variable as
variable=`eval echo... (3 Replies)
Hello Folks,
I have a script that runs a command (rsync) that sometimes takes a long time to complete and produces diagnostic output on stdout as it runs.
I am currently capturing this output in a variable and using it further in the script. I would like to continue to capture this output... (2 Replies)
Hi,
i have an issue with eval and variable assignment.
1) i have a date value in a variable and that date is part of a filename,
var1=20100331
file1=${var1}-D1-0092.xml.zip
file2=${var2}-D2-0092.xml.zip
file3=${var3}-D3-0092.xml.zip
i am passing the above variables to a script via... (11 Replies)
Hi Folks,
I'm looking to figure something out in an existing script I'm trying to understand.
the command in question(on a Solaris Box using KSH) is: WORKDIR=/tmp/namereplaced.exec.$$.$RANDOM
Now, I know it's setting the $workdir environmental variable...
And I understand most of... (2 Replies)
pattern1=book
{
x=1
eval echo \$pattern$x
}
book (this is the output)
But when I assign a variable to the output of the eval it doesn't work unless I prefix 2 times backslash before $ as shown below.
{
a=`eval echo \\$pattern$x`
echo $a
}
book
Why here twice "\" has to be... (3 Replies)
I have a section of a script where I want to check a log file for a certain oracle error and if there is only one error (and it is ORA-39152) then I want to email that script is complete. Otherwise email failure and log.
Somehow with this while the log only has one error and it is ORA-39152, I... (5 Replies)
Discussion started by: cougartrace
5 Replies
LEARN ABOUT PHP
boolval
BOOLVAL(3) 1 BOOLVAL(3)boolval - Get the boolean value of a variableSYNOPSIS
boolean boolval (mixed $var)
DESCRIPTION
Returns the boolean value of $var.
PARAMETERS
o $var
- The scalar value being converted to a boolean.
RETURN VALUES
The boolean value of $var.
EXAMPLES
Example #1
boolval(3) examples
<?php
echo '0: '.(boolval(0) ? 'true' : 'false')."
";
echo '42: '.(boolval(42) ? 'true' : 'false')."
";
echo '0.0: '.(boolval(0.0) ? 'true' : 'false')."
";
echo '4.2: '.(boolval(4.2) ? 'true' : 'false')."
";
echo '"": '.(boolval("") ? 'true' : 'false')."
";
echo '"string": '.(boolval("string") ? 'true' : 'false')."
";
echo '"0": '.(boolval("0") ? 'true' : 'false')."
";
echo '"1": '.(boolval("1") ? 'true' : 'false')."
";
echo '[1, 2]: '.(boolval([1, 2]) ? 'true' : 'false')."
";
echo '[]: '.(boolval([]) ? 'true' : 'false')."
";
echo 'stdClass: '.(boolval(new stdClass) ? 'true' : 'false')."
";
?>
The above example will output:
0: false
42: true
0.0: false
4.2: true
"": false
"string": true
"0": false
"1": true
[1, 2]: true
[]: false
stdClass: true
SEE ALSO floatval(3), intval(3), strval(3), settype(3), is_bool(3), Type juggling.
PHP Documentation Group BOOLVAL(3)