2

I have a problem with Wordpress. I am running this function:

function name($text = '', $relative = false, $icon = true) {

echo $text;
echo $relative;
echo $icon;

}

and the output of it is just "1" (one). How is it possible? Shouldn't be 3 lines of code (3 answers)? I am using apache 2.4, php 5.4.1 and wordpress 3.4 beta 3 on windows 7.

2 Answers 2

1

if you add wrapper dummies and line breaks to each echo, you'll find why it is showing just "1":

function name($text = '', $relative = false, $icon = true) {

echo "text:".$text.";<br>";
echo "relative:".$relative.";<br>";
echo "icon:".$icon.";<br>";

}

name();

outputs :

text:;
relative:;
icon:1;
Sign up to request clarification or add additional context in comments.

Comments

1

Thats correct.

<?php
$text='';
$relative=false;
$icon=true;

echo $text;
echo $relative;
echo $icon;

?>

First one is null, second one is false which is treated as 0 which is outputed as null. The last one is true, which is 1. Wich makes the output 1.

As shown here:

1

(output of above script)

1 Comment

As in not outputting anything (null). Not literally null.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.