Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard scriptlets, jo <? ... ?> syntax ka upyog #4205

Open
mudassarmuz opened this issue Dec 19, 2024 · 1 comment
Open

Standard scriptlets, jo <? ... ?> syntax ka upyog #4205

mudassarmuz opened this issue Dec 19, 2024 · 1 comment

Comments

@mudassarmuz
Copy link

Standard scriptlets, jo syntax ka upyog karte hain, code ko execute karte hain jiske liye explicit output nahi hota hai. Lekin, jaise ki is udaaharan mein dikhaaya gaya hai, scriptlet ke andar code ke parinaam bhi HTML code content ko prabhavit kar sakte hain.

Yeh hain kuchh tarah ke code jo aap scriptlet mein upyog kar sakte hain:

Variable Assignment

<?php 
 $name = "John Doe"; 
?>
<html>
 <body>
  <h1>Hello, <?php echo $name; ?>!</h1>
 </body>
</html>

Control Structures

<?php 
 $age = 25; 
?>
<html>
 <body>
  <?php if ($age >= 18) { ?>
   <p>You are an adult!</p>
  <?php } else { ?>
   <p>You are a minor!</p>
  <?php } ?>
 </body>
</html>

Function Calls

<?php 
 function greet($name) {
  return "Hello, $name!";
 }
?>
<html>
 <body>
  <h1><?php echo greet("John Doe"); ?></h1>
 </body>
</html>

Object Manipulation

<?php 
 $person = array("name" => "John Doe", "age" => 25); 
?>
<html>
 <body>
  <h1><?php echo $person["name"]; ?></h1>
  <p>Age: <?php echo $person["age"]; ?></p>
 </body>
</Html 
@trevorade
Copy link
Contributor

Yah Closure Compiler ke lie github projekt hai, isaka php se koee lena-dena nahin hai... kya aap is mudde ko kaheen aur post karana chaahate the?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants