Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>Note: If you have no idea what an 'Object' is, the next paragraph might not make sense. I added links at the end to learn more about 'objects' and what they are</em></p> <p>This will access the method inside the class that has been assigned to HTML.</p> <pre><code>class html { function redirect($url) { // Do stuff } function foo() { echo "bar"; } } $html = new html; $html-&gt;redirect("URL"); </code></pre> <p>When you create a class and assign it to a variable, you use the '->' operator to access methods of that class. Methods are simply functions inside of a class.</p> <p>Basically, 'html' is a type of object. You can create new objects in any variable, and then later use that variable to access things inside the object. Every time you assign the HTML class to a varaible like this:</p> <pre><code>$html = new html; </code></pre> <p>You can access any function inside of it like this</p> <pre><code>$html-&gt;redirect(); $html-&gt;foo(); // echos "bar" </code></pre> <p>To learn more you are going to want to find articles about Object Oriented Programming in PHP</p> <p>First try the PHP Manual:<br> <a href="http://us2.php.net/manual/en/language.oop.php" rel="nofollow noreferrer">http://us2.php.net/manual/en/language.oop.php</a><br> <a href="http://us2.php.net/oop" rel="nofollow noreferrer">http://us2.php.net/oop</a></p> <p>More StackOverflow Knowledge:<br> <a href="https://stackoverflow.com/questions/1224789/php-classes-when-to-use-vs/">PHP Classes: when to use :: vs. -&gt;?</a><br> <a href="https://stackoverflow.com/questions/tagged/oop">https://stackoverflow.com/questions/tagged/oop</a><br> <a href="https://stackoverflow.com/questions/249835/book-recommendation-for-learning-good-php-oop">https://stackoverflow.com/questions/249835/book-recommendation-for-learning-good-php-oop</a><br> <a href="https://stackoverflow.com/questions/716412/why-use-php-oop-over-basic-functions-and-when">Why use PHP OOP over basic functions and when?</a><br> <a href="https://stackoverflow.com/questions/135535/what-are-the-benefits-of-oo-programming-will-it-help-me-write-better-code">What are the benefits of OO programming? Will it help me write better code?</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload