Defining variable in PHP [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
So I've been trying to understand some of this PHP/HTML code I came over but it doesn't work at all, what am I missing?
<?php
$page = 'Start';
include 'themes/battlefield4/header.php';
?>
<h1><?php $page ?></h1>
<?php
include 'themes/battlefield4/footer.php';
?>

You have to echo or print any output
<h1><?php echo $page ?></h1>

Related

Creating custom template page in Wordpress [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How to create Custom template page in wordpress.
Seems like you are looking for a HitCounter.
Add this on your bottom of your homepage...
#$cont=(int)file_get_contents('counter.txt');
echo "You visited ".(int)file_get_contents('counter.txt')." times.";
file_put_contents('counter.txt',++$cont);// "prints" You visited 3 times.

PHP Echo pre-pend characters [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have built a PHP echo statement like this:
<?php echo(rawurlencode($row['base'])); ?>
How do I omit the first 7 characters of the data that is returned?
http://www.php.net/substr
<?php echo substr(rawurlencode($row['base']), 7); ?>
<?php
$result = substr(rawurlencode($row['base']), 7);
echo $result;
?>

Why the new line is not being inserted between two values? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
My code is as follows:
for($i=0;$i<=100;$i++){
echo $i."<br>";
}
and the output I got is:
0<br>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br>31<br>32<br>33<br>34<br>35<br>36<br>37<br>38<br>39<br>40<br>41<br>42<br>43<br>44<br>45<br>46<br>47<br>48<br>49<br>50<br>51<br>52<br>53<br>54<br>55<br>56<br>57<br>58<br>59<br>60<br>61<br>62<br>63<br>64<br>65<br>66<br>67<br>68<br>69<br>70<br>71<br>72<br>73<br>74<br>75<br>76<br>77<br>78<br>79<br>80<br>81<br>82<br>83<br>84<br>85<br>86<br>87<br>88<br>89<br>90<br>91<br>92<br>93<br>94<br>95<br>96<br>97<br>98<br>99<br>100<br><!DOCTYPE html>
Why this thing is happening:
This is happening because that is what you have programmed. Echo does not auto-append a newline, nor does using <BR>.
Change your code to include a newline:
for($i=0;$i<=100;$i++){
echo $i."<br>\n";
}

How to make this code show capital first letters using ucfirst? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
how do I include ucfirst into this code:
<?php echo $this -> title ?>
I want to make all title page show a capital letter for the first character.
Example hello would become Hello
<?php echo ucfirst($this->title); ?>
I wouldn't do it with PHP. This is a presentational task and should be done using CSS:
<span style="text-transform:capitalize"><?php echo $this->title; ?></span>
For brevity I've used an inline style declaration, a class would be better in real-life.

Find specific string from response in php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am getting following response
{"success":true,"error":false,"code":"SJKUT3GR"}
I just want to print SJKUT3GR from above.
anyone knows how to do this?
$data = json_decode($response);
echo $data->code;

Categories