PDA

View Full Version : PHP..



Andys
28-03-2007, 03:37 PM
Okay im new to PHP and i just need to know how to;

Center somthing
Put somthing on next line (Like <br>)
Differant font and size etc..

so style rly

YouFail
28-03-2007, 03:40 PM
Erm.
I presume you mean in an echo so:



<?php

echo "<br/>"; IS NEW LINE
echo "<center></center>"; IS CENTER
echo "<font family=\"verdana\"></font>"; WOULD SET FAMILY.


CBA writing more. Dunno if last one is right as I always use CSS for these things.

Tomm
28-03-2007, 03:43 PM
PHP is not an alternative to HTML :s

PHP is a server-side language.

YouFail
28-03-2007, 03:59 PM
Yes tom. But im guessing he's asking for inner script etc.

Splinter
28-03-2007, 04:39 PM
Erm.. php is a server side language which is run by the server to output html depending on the script you write. HTML is a mark-up language which is interpreted.

Therefore php can dynamically change what is in the file and HTML displays this.

Voldemort
29-03-2007, 05:29 AM
ooh, let's make it really complicated!


<?php
function center($text){
echo "<center>".$text."</center>";
}

function break(){
echo "<br />";
}

function font($text,$font){
echo "<font family='".$font."'>".$text."</font>";
}

function size($text,$size){
echo "<font size='".$size."'>".$text."</font>";
}

center("Centered Text");
break();
font("Verdana Text","verdana");
break();
size("Big Text",32);
break();

?>

Agnostic Bear
29-03-2007, 09:51 AM
ooh, let's make it really complicated!


<?php
function center($text){
echo "<center>".$text."</center>";
}

function break(){
echo "<br />";
}

function font($text,$font){
echo "<font family='".$font."'>".$text."</font>";
}

function size($text,$size){
echo "<font size='".$size."'>".$text."</font>";
}

center("Centered Text");
break();
font("Verdana Text","verdana");
break();
size("Big Text",32);
break();

?>

Lets make it more complicated, as that wasn't complicated, probably more complicated than you can understand!



<?php
class oh
{
function yes($string)
{
$string = ucfirst(strtolower($string));
echo("$string yes!<br />");
}
function why($string)
{
$string = ucfirst(strtolower($string));
echo("$string! but why?<br />");
}
}
$lul = new oh;
$lul->why("Rofl.");
$lul->yes("Lol");
?>

timROGERS
29-03-2007, 03:11 PM
lol at how many people will be confused by that ;)

Tomm
29-03-2007, 03:29 PM
Lets make it more complicated


<?php
class oh
{
function yes($string)
{
eval(base64_decode('JHN0cmluZyA9IHVjZmlyc3Qoc3RydG 9sb3dlcigkc3RyaW5nKSk7DQplY2hvKFwiJHN0cmluZyB5ZXMh PGJyIC8+XCIpOw=='));
}
function why($string)
{
eval(base64_decode('JHN0cmluZyA9IHVjZmlyc3Qoc3RydG 9sb3dlcigkc3RyaW5nKSk7DQplY2hvKFwiJHN0cmluZyEgYnV0 IHdoeT88YnIgLz5cIik7'));
}
}
$lul = new oh;
$lul->why("Rofl.");
$lul->yes("Lol");
?>

F32
29-03-2007, 03:32 PM
Let's make it more complicated:


<?PHP
echo
?>

Invent
29-03-2007, 04:02 PM
Lets make it more complicated, as that wasn't complicated, probably more complicated than you can understand!

Still hardly complicated. (Your code).

Voldemort
29-03-2007, 10:05 PM
Still hardly complicated. (Your code).
I agree. All you did was make it an object and make every first letter capitalized, which is makes it look noobish...

Sygon..
29-03-2007, 10:07 PM
ooh, let's make it really complicated!


<?php
function center($text){
echo "<center>".$text."</center>";
}

function break(){
echo "<br />";
}

function font($text,$font){
echo "<font family='".$font."'>".$text."</font>";
}

function size($text,$size){
echo "<font size='".$size."'>".$text."</font>";
}

center("Centered Text");
break();
font("Verdana Text","verdana");
break();
size("Big Text",32);
break();

?>

thats a bit stupid.. surely i couldnt be bothered to use a function every time i wanted to center something just slows it down man just use pure html alot easier or use css..

Agnostic Bear
30-03-2007, 05:33 AM
Still hardly complicated. (Your code).


Cause I couldn't be bothered ¬.¬

Splinter
30-03-2007, 09:29 AM
Lol people trying to show how complicated they can code php. :)

Xuggle
30-03-2007, 09:54 AM
Let's make it more complicated:


<?PHP
echo
?>
Oh, haha. :rolleyes:

Want to hide these adverts? Register an account for free!