Jump to content

Starting to learn PHP, please help me.


siggibk
Go to solution Solved by requinix,

Recommended Posts

Okay so i have one question before i start learning php, when you make a function or like date of time, where and how do you make that function appear in a specific division on the site? Do you like make a <div> inside of html for each of the function and then somehow link the function from .php to the html file and then it appears/functions in that section you reffered it in the html file ? 

 

I really hope some of you understand where i'm going with this, sorry for my terrible explanation and my english.

Link to comment
Share on other sites

  • Solution

It sounds like you should start learning PHP now and ask questions later, rather than ask questions now and learn later. Because the whole idea of learning is so that you don't have to ask questions ;)

 

Short version? You define the function somewhere* and call it at the point you want. Like if the function is

function now() {
    return date("Y-m-d H:i:s");
}
then you can call it as

whatever HTML you want here
<?php

echo now(); // echo to output whatever value now() returned

?>
whatever other HTML you want here
DIVs or SPANs or whatever, it doesn't matter as far as PHP is concerned.

 

* It has to be defined by the time you try to use it. That means you define it in the same file (for the most part), or you define it in another file and require that file (at which point PHP will execute that file and "load" the function).

Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.