PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

PHP · Theory

$ and $$

← All stacks

Theory

11/352

$ and $$

Don’t start $ and $$ with jargon. Start with $marks = 72. That is the whole point.

Keep $ and $$ small. Rohit should finish $marks = 72 in a few lines, not a 40-line dump.

Skip $ and $$ and using marks without $ shows up in a result script.

$ and $$ shows up in a result script. Name $marks = 72, not “a real-world scenario”.

If $marks = 72 breaks under $ and $$, check using marks without $ first.

Place $ and $$ next to nearby PHP work — $name = 'Asha'; is the link.

Close $ and $$ with — “If I skip it, $marks = 72 goes wrong like this: using marks without $.”

Exam tip

Say $ and $$ in one breath, then $name = 'Asha';, then using marks without $.

Example

<?php
// $ and $$
$scores = [80, 90, 70];
$avg = array_sum($scores) / count($scores);
echo "avg=" . number_format($avg, 1) . "\n";
foreach ($scores as $s) {
  if ($s >= 80) echo "high: $s\n";
}

$ and $$: scores array, print avg, then high marks. Say the output.

Short notes

  • Def$ and $$ — Rohit uses it for $marks = 72 in a result script.
  • Rule$ and $$ → $name = 'Asha';.
  • Remember$ and $$ + a .php page (a result script).
  • Use$ and $$ in a result script ($marks = 72).
  • Trap$ and $$ — using marks without $.
  • Ex$ and $$ → $marks = 72.

Questions

1

In one breath: what does $ and $$ do for Rohit?

2

When would Rohit actually reach for $ and $$?

3

Which mistake makes $marks = 72 fail?

4

Show $ and $$ in a .php page terms — three lines max.

Previous← Variable ScopeNextConstants →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.