Thread: Counting PHP

Results 1 to 8 of 8
  1. #1
    BGS. flameboy's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,067
    Reputation
    32
    Thanks
    51
    My Mood
    Fine

    Counting PHP

    Heey guys, I just got eveloved in PHP but, something I don't understand and I googled it but could not find it.
    How can I count, $toshiba["prijs"] + $acer["prijs"] + $HP["prijs"] ?

    Virusscans
    [1],[2]

    This is my code:

    Code:
    <html>
    	<head>
    		<title>LAB 2, les 4</title>
    	</head>
    	<body>
    		<header><b>HASH-arrays</b></header>
    		<?php
    			$toshiba["merk"] = " Toshiba Satellite ";
    			$toshiba["model"] = " A100 ";
    			$toshiba["OS"] = " Windows 8 ";	
    			$toshiba["voorraad"] = 80;
    			$toshiba["prijs"] = 999;
    			$totaal = $toshiba["prijs"];
    			$acer["merk"] = " Acer Aspire ";
    			$acer["model"] = " 5732Z ";
    			$acer["OS"] = " Linux ";	
    			$acer["voorraad"] = 0;
    			$acer["prijs"] = 888;
    			$HP["merk"] = " HP ";
    			$HP["model"] = " 200X ";
    			$HP["OS"] = " Windows Vista ";	
    			$HP["voorraad"] = 50;
    			$HP["prijs"] = 777;
    		echo("<table border='1'> " . "
    			<caption>
    			<strong>SML laptops</strong>
    			</caption>
    			<thead>
    				<tr>
    					<th>Merk</th><th>Model</th><th>Operating System</th><th>Voorraad</th><th>Prijs</th> 
    				</tr>
    			</thead>
    			<tbody>
    			<tr>
    				<td>" . $toshiba["merk"] . "</td>" . "
    				<td>" . $toshiba["model"]. "</td>" . "
    				<td>" . $toshiba["OS"] . "</td>" . "
    				<td>" . $toshiba["voorraad"] . "</td>" . "
    				<td>" . $toshiba["prijs"] . "</td>" . "
    			</tr>
    			<tr>
    				<td>" . $acer["merk"] . "</td>" . "
    				<td>" . $acer["model"]. "</td>" . "
    				<td>" . $acer["OS"] . "</td>" . "
    				<td>" . $acer["voorraad"] . "</td>" . "
    				<td>" . $acer["prijs"] . "</td>" . "
    			</tr>
    			<tr>
    				<td>" . $HP["merk"] . "</td>" . "
    				<td>" . $HP["model"]. "</td>" . "
    				<td>" . $HP["OS"] . "</td>" . "
    				<td>" . $HP["voorraad"] . "</td>" . "
    				<td>" . $HP["prijs"] . "</td>" . "
    			</tr>
    				<tfoot>
    					<tr> 
    						<td colspan='4'>Totaal</td> <td> " . $totaal . "</td>
    					</tr>
    				</tfoot>
    			</tbody>
    		</table>");
    		?>
    	</body>
    </html>
    <b>Downloadable Files</b> Downloadable Files
    Feel free to pm me: Click Here
    Skype: strongvim

  2. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    <?php
    $toshiba["merk"] = " Toshiba Satellite ";
    $toshiba["model"] = " A100 ";
    $toshiba["OS"] = " Windows 8 ";
    $toshiba["voorraad"] = 80;
    $toshiba["prijs"] = 999;
    $acer["merk"] = " Acer Aspire ";
    $acer["model"] = " 5732Z ";
    $acer["OS"] = " Linux ";
    $acer["voorraad"] = 0;
    $acer["prijs"] = 888;
    $HP["merk"] = " HP ";
    $HP["model"] = " 200X ";
    $HP["OS"] = " Windows Vista ";
    $HP["voorraad"] = 50;
    $HP["prijs"] = 777;
    $totaal = $toshiba["prijs"] + $acer["prijs"] + $HP["prijs"];

    maybe?

     


    <?php
    $toshiba["merk"] = " Toshiba Satellite ";
    $toshiba["model"] = " A100 ";
    $toshiba["OS"] = " Windows 8 ";
    $toshiba["voorraad"] = 80;
    $toshiba["prijs"] = 999;
    $totaal = $toshiba["prijs"];
    $acer["merk"] = " Acer Aspire ";
    $acer["model"] = " 5732Z ";
    $acer["OS"] = " Linux ";
    $acer["voorraad"] = 0;
    $acer["prijs"] = 888;
    $totaal += $acer["prijs"];
    $HP["merk"] = " HP ";
    $HP["model"] = " 200X ";
    $HP["OS"] = " Windows Vista ";
    $HP["voorraad"] = 50;
    $HP["prijs"] = 777;
    $totaal += $HP["prijs"];
    Last edited by abuckau907; 09-06-2013 at 04:51 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  3. #3
    BGS. flameboy's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,067
    Reputation
    32
    Thanks
    51
    My Mood
    Fine
    Yes, Thank you. That worked
    Feel free to pm me: Click Here
    Skype: strongvim

  4. #4
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Np, you posted the answer in your question : )

    Quote Originally Posted by BGS. flameboy View Post
    ...
    How can I count, $toshiba["prijs"] + $acer["prijs"] + $HP["prijs"] ?
    ...
    $totaal = $toshiba["prijs"] + $acer["prijs"] + $HP["prijs"]

    : p

    w3schools is good for leaning the basics.
    PHP Operators
    Last edited by abuckau907; 09-07-2013 at 02:08 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  5. #5
    NeneDelFLow's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    40
    any other questions tellme (y)
    SUCCESSFUL TRADES
    1- *]Nuage
    2- konjugacija-x (He went first.)
    3- AtlantaFalcons
    4- Tragedy`
    5- lillacharlie (He went first.)
    6- Devil™ (He went first.)
    7- ILoveLasagna (He went first.)

  6. #6
    rchayne's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Location
    Australia
    Posts
    1,717
    Reputation
    276
    Thanks
    666
    My Mood
    Psychedelic
    I laughed hard at this xD
    https://www.mpgh.net/forum/443-crossf...m-service.html


    [IMG]https://www.danasof*****m/sig/RChayne.jpg[/IMG]

    If I farmed for you!
    If I did a fucking awesome job!


  7. #7
    BGS. flameboy's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,067
    Reputation
    32
    Thanks
    51
    My Mood
    Fine
    Quote Originally Posted by rchayne View Post
    I laughed hard at this xD
    wauw thanks...
    Feel free to pm me: Click Here
    Skype: strongvim

  8. #8
    IWillNeverUnderstand's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    472
    Reputation
    136
    Thanks
    1,234
    My Mood
    Cheeky
    you can ask me if you need anything. :P this is toooo basic

Similar Threads

  1. obligitary count to a bagalion thread
    By i eat trees in forum Spammers Corner
    Replies: 166
    Last Post: 05-03-2012, 01:57 PM
  2. User Count
    By ilove2 in forum Visual Basic Programming
    Replies: 8
    Last Post: 08-11-2007, 08:32 PM
  3. COUNT DOWN :o
    By i eat trees in forum WarRock - International Hacks
    Replies: 42
    Last Post: 07-21-2007, 02:12 AM
  4. Aid Counts Japanese
    By ariano in forum WarRock Korea Hacks
    Replies: 0
    Last Post: 06-09-2007, 09:14 AM
  5. Attention: New Post Count Rule
    By Bull3t in forum Help & Requests
    Replies: 0
    Last Post: 06-15-2006, 09:39 AM