hi very short question
can php return a boolean like this:
return $aantal == 0;
like in java you can
public boolean test(int i)
{
return i==0;
}
or do you Have to use a if contruction?
because if i do this.
$foutLoos = checkFoutloos($aantal);
function checkFoutloos($aantal)
{
return $aantal == 0;
}
echo "foutLoos = $foutLoo...
My goal is to store some html-formatted data in a variable, then echo it later.
For example:
<?php
$foo = '<div id="x">';
echo $foo;
?>
The above doesn't work. Why?
Edit
Sorry for the bad question.
I thought it didn't work because nothing is visible when viewed in a browser.
Of course nothing is visible because there is only a div...
Ok i have this controller:
class ExampleController extends AppController {
var $name = 'Example';
public function test_me () {
$this->Example->Create();
$this->Example->set( 'variable_from_db_1' => 'random_value_1',
'variable_from_db_2' => 'random_value_2' );
//here, how can i...
Suppose I have a static variable declared inside a function in c.
If I call that function multiple times, does the static variable get re-allocated in memory every time the function call? If it does, why the last value can always be maintained?
Example:
void add()
{
static int x = 1;
x++;
printf("%d\n",x);
}
int main()
{
...
I have the following code that worked fine till now as I decided to add more variables to the form. How can I make this function smart and itterate and pass all the variables in the form?
function getquerystring(strFormName) {
var form = document.forms[strFormName];
var word = form.clock_code.value;
qstr = 'clock_co...
How can I change the value of a variable via a function that consumes lambda parameter?
Ie:
;;definitions
(define test "fails")
(define (experiment input) (set! input "works"))
;;interactions
> test
"fails"
> (experiment test)
> test
"fails"
This seems to fail..
Regards
...
I have a shell script that will let me access global variables inside the script, but when I try to create my own, it responds with: command not found.
#!/bin/bash
J = 4
FACE_NAME = "eig$J.face"
USER_DB_NAME = "base$J.user"
When I run the above script I get:
./test1.sh line 2: J: command not found
./test1.sh line 3: FACE_NAME: comman...
I am generating some head html in page load and because of that I query database once. in the page I query database again and put data into html with inline code.
my question is is there better way to do this? I dont want to query database everytime and reach out those filled variables from inline code. something like page.addVariable ...
I have a language file with a long list of strings for my view files.
My question is how to pass a variable or a config item to a language file?
<?php $lang['error_activation_key_expired'] = 'The activation key you have attempted using has expired. Please request a new Activation Key <a href="'.$this->config->item('base_url').'member/re...
I have a few local variables and I want to divide them all divide them all by the same number.
decimal a = 0;
decimal b = 0;
decimal c = 0;
...
decimal n = 0;
decimal divisor = 0;
<perform calculations to give all variables meaningful values>
divide each decimal (a - n) by divisor then assign value
Beside dividing and assigning eve...
From one of VBA tutorials I learned that variables contining numbers should be firstly declared as integers:
Dim mynumber as integer
But, please, look at this code:
Sub math()
A = 23
B = 2
ABSumTotal = A + B
strMsg = "The answer is " & "$" & ABSumTotal & "."
MsgBox strMsg
strMsg = "The answer is " & "$" & Sqr(AB...
I have a for loop in action script which I'm trying to use to dynamically create variable.
Example
for( i = 0 ; i i++)
{
var MyVar+i = i;
}
after this for loop runs, i would like to have 3 variables named MyVar1, MyVar2, MyVar3. I know the code above will give you a syntax error, but that is just to illustrate what I am trying...
Hi, I'm trying to write a function that accepts a variable number of parameters like printf, does some stuff, then passes the variable list to printf. I'm not sure how to do this, because it seems like it would have to push them onto the stack.
Something approximately like this
http://pastie.org/694844
#include <stdio.h>
#include <st...
Hey Guys, I'm having a tad of an issue dealing with Dynamic Variable Names. What is happening is I have a CFC that builds part of form for me using some data in a table. Then the cfc sends the form's code back to the page as a string. Well I need to assign values to these form fields so people don't overwrite the data. I'm pulling the da...
Let X = sum of n iid random variables.
X = \sum_{i=1}^n X_i
where n is a poisson random variable with some mean
i have to calculate Pr(X > a)
I am not able to apply the chernoff's bound theorem as poisson random variable is in th epower.
pl help me
Ranjan
...
I am trying to make a script that when you type in a hex value and press submit itchanges the text color to the color inputted.
It seems the problem is the way i am calling the variable "userInput" inside the variable new html
Any Ideas?
<script type="text/javascript">
function changeText3(){
var userInput = document.getElementB...
I have a JavaScript variable which contains the name of a JavaScript function. This function exists on the page by having been loaded in and placed using $.ajax, etc.
Can anyone tell me how I would call the javascript function named in the variable, please?
The name of the function is in a variable because the URL used to load the page...
Let's say I have this variable:
word = "habit"
which command in VBA will allow me to count how many characters are there in this variable (in my case it's 5).
Important: the variable "word" contains only one word, no spaces, but may have contain numbers and hyphens.
...
Sorry about all these silly questions, I've been thrust into Perl programming and I'm finding it really hard to think like a Perl programmer.
Silly question for today:
I load a pipe delimited file into a hash using the id field as the key, like so
#open file
my %hash;
while (<MY_FILE>) {
chomp;
my ($id, $path, $date) = split ...
How does php cast boolean variables?
I was trying to save a boolean value to an array:
$result["Users"]["is_login"] = true;
but when I use debug the is_login value is blank.
and when I do conditionals like:
if($result["Users"]["is_login"])
the conditions are always false.
Then i tried doing this:
$result["Users"]["is_login"] = "...