Jump to content

PHP Variables


Recommended Posts

Posted

Hi Just trying to figure out how to insert a variable in PHP (from the user configuration). I'm pretty new to PHP. Any help would be appreciated

 

<?php

$gross = $argv[1];
$pct = {var:pct}


$total = $gross * $pct + $gross;
$sum = round($total, 2);
$sum2 = number_format($total, 2);
$tax = number_format($gross * $pct, 2);


$item = array('title' => "Total = $$sum2, Tax = $$tax", 'subtitle' => "↵ to copy to clipboard", 'arg' => "$sum");
$json = json_encode(array('items' => array($item)));

echo $json;  // send JSON to Alfred
?>

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...