php assign data

Buckle up, fellow PHP enthusiast! We're loading up the rocket fuel for your coding adventures...

  • Best Practices ,

php assign data

  • How do I assign a value to a variable in PHP?

Hey everyone, I'm new to PHP and I'm having some trouble figuring out how to assign a value to a variable. I've been searching online but couldn't find a clear answer. Can someone please help me out? I've already declared the variable, let's say its name is "myVariable". Now, how do I assign a value to it? Do I use an equal sign or is there another way? Also, can I assign any type of value to the variable, like a string or a number? Thanks in advance for your help!

All Replies


Hey there, welcome to the PHP world! Assigning a value to a variable in PHP is actually quite straightforward. All you need to do is use the "=" (equal sign) operator. For example, if you have a variable named "myVariable" and you want to assign the value "Hello, PHP!" to it, you would write: php $myVariable = "Hello, PHP!"; That's it! The value "Hello, PHP!" is now stored in the variable "myVariable". You can assign any type of value to a variable in PHP, whether it's a string, number, boolean, or even an array. PHP is a dynamically typed language, so you don't need to explicitly declare the data type of a variable before assigning a value. I hope this helps! Feel free to ask if you have any more questions.

Related Topics

  • How do I create and access variable variables in PHP?
  • What is the difference between variables and constants in PHP?
  • What is the purposes symbol @ in PHP $variable at blade laravel 5?
  • search - PHP variables don't evaluate in the query
  • How to echo out a php variable into an html link in a wordpress shortcode
  • cron - pass crontab a variable and read it from PHP?
  • PHP variable in an ing src
  • How do I access constants within different scopes or files in PHP?
  • post - PHP How to filter 'in a correct way' All $_POST variables
  • How do I use underscores or camel case in variable names in PHP?


Hey newbie, Glad you're diving into PHP! Assigning a value to a variable in PHP is as easy as it gets. You simply use the "=" operator to assign a value. So, assuming you already declared your variable as "myVariable", here's how you assign a value: php $myVariable = "Here's the value!"; You got it! By using the equal sign, you've assigned the string "Here's the value!" to your variable. PHP is cool because it's dynamically typed, meaning you don't have to declare the variable's data type beforehand. You can assign strings, numbers, booleans, or whatever you need. If you run into any further stumbling blocks, don't hesitate to ask. Keep on coding!


Hey there, PHP enthusiast! Assigning a value to a variable in PHP is a breeze. All you have to do is use the "=" (equal sign) operator. So, assuming you've already declared your variable as "myVariable", assigning a value is a piece of cake: php $myVariable = "A value to assign!"; Boom! By using the equal sign, you've successfully assigned the string "A value to assign!" to your "myVariable". In PHP, you have the flexibility to assign various data types to variables, be it strings, numbers, booleans, arrays, or even objects. If you stumble upon any more dilemmas or have other questions, feel free to shout out. Happy coding!

More Topics Related to PHP

  • What are the recommended PHP versions for different operating systems?
  • Can I install PHP without root/administrator access?
  • How can I verify the integrity of the PHP installation files?
  • Are there any specific considerations when installing PHP on a shared hosting environment?
  • Is it possible to install PHP alongside other programming languages like Python or Ruby?

More Topics Related to String

  • What are the basic data types in PHP?
  • How can I convert a variable to a string in PHP?
  • How do I declare a union type in PHP?
  • performance - PHP: Check if variable is type of string AND is not empty string?

More Topics Related to Number

  • session - Reserved characters in PHP $_SESSION variable keys
  • nsregularexpression - PHP regular expression with optional underscore and number
  • Are there any limitations or restrictions when using attributes in PHP?
  • PHP acosh() function (with example)

Popular Tags

  • Best Practices
  • Web Development
  • Documentation
  • Implementation

php assign data

New to Community?

  • Function Reference
  • Variable and Type Related Extensions
  • Variable handling
  • Variable handling Functions

(PHP 4, PHP 5, PHP 7, PHP 8)

settype — Set the type of a variable


Set the type of variable var to type .

The variable being converted.

  • "boolean" or "bool"
  • "integer" or "int"
  • "float" or "double"
  • "string"
  • "array"
  • "object"
  • "null"

Return Values

Returns true on success or false on failure.

Example #1 settype() example

Note : Maximum value for "int" is PHP_INT_MAX .
  • gettype() - Get the type of a variable
  • type-casting
  • type-juggling

User Contributed Notes 17 notes

To Top

38 PHP Date & Time Functions (& How to Use Them)

Clint Fontanella

Published: November 20, 2023

In PHP programming, you often need to manage or manipulate date and time values. However, with the vast array of functions at your fingertips, it can be tricky to keep track of all of the options available.

php date and time functions

How to Get the Date & Time in PHP

There are two ways to obtain the date and time in PHP. You can use the date() function or the  DateTime class.

Using the date() Function

The date()  function obtains the current date and time as a formatted string. It also allows you to specify the format of the output.

Here's an example:

$currentDate  = date ( 'Y-m-d H:i:s' );

echo   "Current date and time: $currentDate" ;

Current date and time: 2023-10-16 15:36:02

In this example,  Y  represents the year, m  represents the month, d represents the day, H represents the hour,  i represents minutes, and s represents seconds.

Using the DateTime Class

The DateTime class offers a bit more flexibility. Not only can you format the output to fit your needs, but you can also specify your timezone which is important when dealing with dates and times in different locations around the world.

Let’s look at an example:

$dateTime  = new   DateTime ();

$currentDate  = $dateTime -> format ( 'Y-m-d H:i:s' );

Current date and time: 2023-10-16 15:38:32

Here, we created a DateTime  object. We can now use it to set the time zone to New York, Paris, Hong Kong, or wherever we need to. Let’s explore that in the next example.

How to Set a Timezone

To set a timezone, we’ll need to apply the DateTimeZone() function to the DateTime  object.

$dateTime  = new   DateTime ( 'now' , new   DateTimeZone ( 'America/New_York' ));

$currentTime  = $dateTime -> format ( 'H:i:s' );

echo   "Current time in New York: $currentTime" ;

Current time in New York: 16:45:21

With the DateTimeZone() function set to America/New_York , this code will display the current time in New York City. If we changed it to Europe/London  it would provide us with the time in London.

For a complete list of date and time functions in PHP, check out the section below. Or, use this handy table to jump to the exact function that you’re looking for.

PHP Date & Time Functions

The  date() function formats the current date and time.

echo   "Current date and time: "  . $currentDate ;


Current date and time: 2023-10-16 14:13:13

The  time() function returns the current time in seconds since the Unix Epoch.

$currentTimestamp  = time ();

echo   "Current Unix timestamp: "  . $currentTimestamp ;

Current Unix timestamp: 1697033672

3. strtotime()

This function parses a string into a Unix timestamp.

$dateString  = "2023-10-15 15:30:00" ;

$timestamp  = strtotime ( $dateString );

echo   "Unix timestamp for $dateString: "  . $timestamp ;

Unix timestamp for 2023-10-15 15:30:00: 1697383800

4. mktime()

This function returns the Unix timestamp for a date.

$timestamp  = mktime ( 12 , 30 , 0 , 10 , 15 , 2023 );

echo   "Unix timestamp for October 15, 2023, 12:30 PM: "  . $timestamp ;

Unix timestamp for October 15, 2023, 12:30 PM: 1697373000

5. checkdate()

This function validates a Gregorian calendar date.

$month  = 2 ;

$day  = 29 ;

$year  = 2024 ;

if  ( checkdate ( $month , $day , $year )) {

echo   "The date is valid: $year-$month-$day" ;

} else  {

echo   "The date is not valid: $year-$month-$day" ;

The date is valid: 2024-2-29

6. strftime()

This function formats a local time and/or date according to local settings. Note:  This function has been deprecated in recent PHP versions.

setlocale (LC_TIME, 'en_US.UTF-8' );

$formattedDate  = strftime ( '%A, %B %d, %Y %H:%M:%S' );

echo   "Formatted date: $formattedDate" ;

Formatted date: Wednesday, October 16, 2023 14:53:47

7. getdate()

The getdate()  function returns date/time information.

$dateInfo  = getdate ();

print_r ( $dateInfo );

    [seconds] => 47

    [minutes] => 54

    [hours] => 14

    [mday] => 16

    [wday] => 3

    [mon] => 10

    [year] => 2023

    [yday] => 283

    [weekday] => Wednesday

    [month] => October

    [0] => 1697036087

8. gettimeofday()

This function returns the current time.

$timeInfo  = gettimeofday ();

print_r ( $timeInfo );

    [sec] => 1697036130

    [usec] => 773136

    [minuteswest] => 0

    [dsttime] => 0

9. gmdate()

gmdate() formats a GMT/UTC date/time.

$utcDate  = gmdate ( 'Y-m-d H:i:s' );

echo   "UTC date and time: $utcDate" ;

UTC date and time: 2023-10-16 14:57:31

10. gmmktime()

This function returns the Unix timestamp for a GMT date.

$timestamp  = gmmktime ( 12 , 30 , 0 , 10 , 15 , 2023 );

echo   "UTC timestamp for October 15, 2023, 12:30 PM: $timestamp" ;

UTC timestamp for October 15, 2023, 12:30 PM: 1697373000

16. gmstrftime()

This function formats a GMT/UTC time and/or date. Note: This function has been deprecated in recent PHP versions.

$utcFormattedDate  = gmstrftime ( '%A, %B %d, %Y %H:%M:%S' );

echo   "Formatted UTC date: $utcFormattedDate" ;

Formatted UTC date: Wednesday, October 16, 2023 14:58:24

12. idate()

The idate()  function formats a local time/date according to local settings.

$date  = idate ( 'H' , time ()); // Use 'H' for the hour  

echo   "Current hour: $date" ;

Current hour: 15

13. microtime()

microtime()  returns the current Unix timestamp with microseconds.

$microtime  = microtime ( true );

echo   "Current Unix timestamp with microseconds: $microtime" ;

Current Unix timestamp with microseconds: 1697036452.6927

14. strptime()

This function parses a time/date generated with  strftime() .

$dateString  = '2023-10-15 15:30:00' ;

$format  = 'Y-m-d H:i:s' ;

$date  = DateTime :: createFromFormat ( $format , $dateString );

echo   "Parsed Date: "  . $date -> format ( $format );

Parsed Date: 2023-10-15 15:30:00

15. date_add()

The date_add() function adds days, months, years, hours, minutes, and seconds to a date.

$date  = new   DateTime ( '2023-10-15' );

$date -> add ( new   DateInterval ( 'P3D' )); // Add 3 days  

echo   "New Date: "  . $date -> format ( 'Y-m-d' );

New Date: 2023-10-18

16. date_create()

This function returns a new DateTime  object.

$date  = date_create ( '2023-10-15' );

echo   "Created Date: "  . date_format ( $date , 'Y-m-d' );

Created Date: 2023-10-15

17. date_diff()

This function returns the difference between two  DateTime  objects.

$date1  = new   DateTime ( '2023-10-15' );

$date2  = new   DateTime ( '2023-10-20' );

$interval  = $date1 -> diff ( $date2 );

echo   "Difference: "  . $interval -> format ( '%R%a days' );

Difference: +5 days

18. date_format()

This function returns a date formatted according to a given format.

$formattedDate  = date_format ( $date , 'l, F j, Y' );

echo   "Formatted Date: "  . $formattedDate ;

Formatted Date: Sunday, October 15, 2023

19. date_sunrise()

The date_sunrise()  function returns the time of sunrise for a given day and location.  Note:  This function is deprecated in recent PHP versions.

$latitude  = 37.7749 ; // Latitude for San Francisco  

$longitude  = - 122.4194 ; // Longitude for San Francisco  

$sunrise  = date_sunrise ( time (), SUNFUNCS_RET_STRING, $latitude , $longitude );

echo   "Sunrise time: $sunrise" ;

Sunrise time: 14:13

20. date_sunset()

The date_sunset()  function returns the time of sunset for a given day and location. Note:  This function is deprecated in recent PHP versions.

$sunset  = date_sunset ( time (), SUNFUNCS_RET_STRING, $latitude , $longitude );

echo   "Sunset time: $sunset" ;

Sunset time: 01:39

21. date_default_timezone_get()

This function returns the default timezone used by all date/time functions in a script.

$timezone  = date_default_timezone_get ();

echo   "Default Time Zone: $timezone" ;

Default Time Zone: UTC

22. date_default_timezone_set()

This sets the default timezone used by all date/time functions in a script.

date_default_timezone_set ( 'America/New_York' );

echo   "Updated Default Time Zone: $timezone" ;

Updated Default Time Zone: America/New_York

23. date_modify()

This function alters the timestamp of a DateTime object.

$date -> modify ( '+3 days' );

echo   "Modified Date: "  . $date -> format ( 'Y-m-d' );

Modified Date: 2023-10-18

24. date_offset_get()

This function returns the timezone offset from GMT of the given DateTime object.

$date  = new   DateTime ( '2023-10-15' , new   DateTimeZone ( 'America/New_York' ));

$offset  = $date -> getOffset ();

echo   "Time Zone Offset: "  . $offset ;

Time Zone Offset: -14400

25. date_parse()

Date_parse()  returns an associative array with detailed info about a given date.

$dateInfo  = date_parse ( $dateString );

    [month] => 10

    [day] => 15

    [hour] => 15

    [minute] => 30

    [second] => 0

    [fraction] => 0

    [warning_count] => 0

    [warnings] => Array



    [error_count] => 0

    [errors] => Array

    [is_localtime] =>

26. date_parse_from_format()

This function returns an associative array with detailed info about a date formatted according to a specified format.

$dateString  = '15-10-2023' ;

$format  = 'd-m-Y' ;

$dateInfo  = date_parse_from_format ( $format , $dateString );

    [hour] =>

    [minute] =>

    [second] =>

    [fraction] =>

27. date_sub()

The  date_sub() function subtracts days, months, years, hours, minutes, and seconds from a date.

$interval  = new   DateInterval ( 'P3D' ); // Subtract 3 days

$date -> sub ( $interval );

New Date: 2023-10-12

28. date_timestamp_get()

This function retrieves the Unix timestamp from a  DateTime  object.


$dateTime  = new   DateTime ( "2023-10-06 15:30:00" );

$timestamp  = date_timestamp_get ( $dateTime );

  echo   "Unix Timestamp: "  . $timestamp ;

Unix Timestamp: 1696606200

29. date_timestamp_set()

This sets the date and time based on an Unix timestamp.

$timestamp  = 1634264400 ; // Unix timestamp for '2023-10-15 12:00:00'  

$date  = new   DateTime ();

$date -> setTimestamp ( $timestamp );

echo   "Set Date: "  . $date -> format ( 'Y-m-d H:i:s' );

Set Date: 2021-10-15 02:20:00

30. date_timezone_set()

This function sets the time zone for a DateTime  object.

$timezone  = new   DateTimeZone ( "America/New_York" );

date_timezone_set ( $dateTime , $timezone );

echo   "Date and Time in New York: "  . $dateTime -> format ( "Y-m-d H:i:s" ) . " " ;

echo   "Time Zone: "  . $dateTime -> getTimezone ()-> getName ();

Date and Time in New York: 2023-10-06 16:30:00 Time Zone: America/New_York

31. date_days_in_month()

This function returns the number of days in a month for a given year and calendar. Note:  this function is provided by the Calendar extension, which may not be enabled by default in all PHP installations.

$year  = 2023 ;

$month  = 2 ; // February  

$daysInMonth  = cal_days_in_month (CAL_GREGORIAN, $month , $year );

echo   "Days in February 2023: $daysInMonth" ;

Days in February 2023: 28

32. date_isodate_set()

The date_isodate_set()  function creates a DateTime object by specifying the year, ISO week number, and ISO day number.

$date  = date_isodate_set ( new   DateTime (), 2023 , 40 , 2 );

echo   "ISO Year: "  . $date -> format ( "Y" ) . " " ;

echo   "ISO Week Number: "  . $date -> format ( "W" ) . " " ;

echo   "ISO Day Number: "  . $date -> format ( "N" ) . " " ;

echo   "Full Date: "  . $date -> format ( "Y-m-d" ) . " " ;

ISO Year: 2023 ISO Week Number: 40 ISO Day Number: 2 Full Date: 2023-10-03

33. date_date_set()

This sets the date to a specified value.

$date -> setDate ( 2023 , 10 , 15 ); // Set the date to October 15, 2023  

echo   "Set Date: "  . $date -> format ( 'Y-m-d' );

Set Date: 2023-10-15

34. date_get_last_errors()

This function returns the warnings and errors in the last date-related function.

$dateString  = '2023-13-32' ; // Invalid date  

$date  = date_create ( $dateString );

$errors  = date_get_last_errors ();

print_r ( $errors );

    [error_count] => 1

            [6] => Unexpected character

35. date_interval_format()

This function formats the interval.

$interval  = new   DateInterval ( 'P2Y3M4DT5H6M7S' ); // A sample interval

$formattedInterval  = $interval -> format ( '%Y years, %M months, %D days' );

echo   "Formatted Interval: "  . $formattedInterval ;

Formatted Interval: 02 years, 03 months, 04 days

36. date_locale_set()

The date_locale_set() f unction sets the locale information.

$locale  = 'en_US' ;

setlocale (LC_TIME, $locale );

echo   "Current Locale: "  . setlocale (LC_TIME, 0 ); // Display the set locale

Current Locale: C

37. date_interval_create_from_date_string()

This function creates a DateInterval  object based on a date interval string.

$intervalString   = "2 weeks 3 days 4 hours 30 minutes" ;

$interval  = date_interval_create_from_date_string ( $intervalString );

echo  "Interval: "  . $interval -> format ( "%y years, %m months, %d days, %h hours, %i minutes" );

Interval: 0 years, 0 months, 17 days, 4 hours, 30 minutes

38. date_timezone_get()

The date_timezone_get()  function returns the time zone associated with a  DateTime  object.

$dateTime  = new   DateTime ( "2023-10-06 15:30:00" ); ;

$timezone  = date_timezone_get ( $dateTime );

echo   "Time Zone: "  . $timezone -> getName ();

Time Zone: UTC

Finding Date & Time Values in PHP

These functions will help you schedule tasks, calculate durations, and track events based on specific dates and times. They'll also enable you to manipulate values, allowing you to compare individual dates or extract information from a specified time period. 

The more you use them, the more comfortable you'll be at recalling them. Until then, feel free to bookmark this page and use it as a handy reference to guide your programming over time -- pun intended.


Don't forget to share this post!

Related articles.

PHP Functions: Each Type & How to Use Them

PHP Functions: Each Type & How to Use Them

58 PHP Keywords That Every Programmer Should Know

58 PHP Keywords That Every Programmer Should Know

44 PHP Math Functions & Examples That Will Save You Time

44 PHP Math Functions & Examples That Will Save You Time

How to Send Emails in PHP With 3 Easy Steps

How to Send Emails in PHP With 3 Easy Steps

80 PHP String Functions (& Examples of Each)

80 PHP String Functions (& Examples of Each)

64 PHP Array Functions & Constants to Bookmark

64 PHP Array Functions & Constants to Bookmark

A free suite of content management tools for marketers and developers.

Earth passed a feared global warming milestone Friday, at least briefly

Average global temperatures were more than 2 degrees celsius above a pre-industrial benchmark on friday, preliminary data show.

php assign data

The planet marked an ominous milestone Friday: The first day global warmth crossed a threshold, if only briefly, that climate scientists have warned could have calamitous consequences .

Preliminary data show global temperatures averaged more than 2 degrees Celsius (3.6 degrees Fahrenheit) above a historic norm, from a time before humans started consuming fossil fuels and emitting planet-warming greenhouse gases.

That does not mean efforts to limit global warming have failed — yet. Temperatures would have to surpass the 2-degree benchmark for months and years at a time before scientists consider it breached.

But it’s a striking reminder that the climate is moving into uncharted territory. Friday marked the first time that everyday fluctuations around global temperature norms, which have been steadily increasing for decades, swung the planet beyond the dangerous threshold. It occurs after months of record warmth that have stunned many scientists, defying some expectations of how quickly temperatures would accelerate this year.

“I think while we should not read too much into a single day above 2C (or 1.5C for that matter) it’s a startling sign nonetheless of the level of extreme global temperatures we are experiencing in 2023,” Zeke Hausfather, a climate scientist with Stripe and Berkeley Earth, said in a message to The Washington Post.

Samantha Burgess, deputy director of the European Union’s Copernicus Climate Change Service, said Sunday on the social media platform X that Friday’s global temperatures were 1.17C (2.1F) above the 1991-2020 average, a record-setting margin.

Given how much human-caused warming had occurred by that period, that means Friday’s average global temperature was 2.06C (3.7F) above a preindustrial reference period, 1850-1900, she said.

Provisional ERA5 global temperature for 17th November from @CopernicusECMWF was 1.17°C above 1991-2020 - the warmest on record. Our best estimate is that this was the first day when global temperature was more than 2°C above 1850-1900 (or pre-industrial) levels, at 2.06°C. — Dr Sam Burgess 🌍🌡🛰 (@OceanTerra) November 19, 2023

The estimate of global warmth comes from a European model that uses the same sorts of observations used in weather predictions to instead look backward, and estimate global climate conditions nearly in real time.

Direct observations that scientists will gather and vet in the coming weeks could soon confirm the record warmth.

A year of record-setting warmth continues

That the globe surpassed the 2-degree warming benchmark for at least one day adds an exclamation point to a string of temperature records set in recent months.

Global temperatures set records in July , August , September and October . The Copernicus data shows that trend has been maintained, if not accelerated, into November.

Even before Saturday, scientists said 2023 was virtually certain to surpass 2016 as the globe’s warmest on record , and likely to mark one of its warmest periods in 125,000 years , going back to a time before Earth’s last ice age. That estimate is based on paleoclimate records that show there was at least no extended period of the sort of warmth the planet is now experiencing, and that temperatures are rising with unprecedented speed.

Analyses released this month show 2023 average global temperatures are likely to end up 1.3 to 1.4C (2.3 to 2.5F) above preindustrial levels . Climate scientists predict that sustained global warming at 1.5 degrees above preindustrial levels could overwhelm societies and upend economies and political systems.

Planetary warming is only expected to accelerate in the coming months because of a deepening El Niño , the infamous climate pattern that drives weather extremes and raises global temperatures by releasing vast stores of heat from the Pacific Ocean into the atmosphere.

But that surge of El Niño-fueled warmth typically does not arrive until after the climate pattern reaches its peak — something forecast to occur this winter. Because of that, scientists had said earlier this year they did not expect the globe to surge to such record warmth until 2024.

Friday’s milestone offers yet more proof of how the planet has defied climate scientists’ expectations this year.

USC neuroscientist faces scrutiny following allegations of data manipulation

The campus of the Keck School of Medicine of USC.

  • Show more sharing options
  • Copy Link URL Copied!

A star neuroscientist at USC is facing allegations of misconduct after whistleblowers submitted a report to the National Institutes of Health that accused the professor of manipulating data in dozens of research papers and sounded alarms about an experimental stroke medication his company is developing.

The accusations against Berislav V. Zlokovic, professor and chair of the department of physiology and neuroscience at the Keck School of Medicine of USC, were made by a small group of independent researchers and reported in the journal Science .

The report identifies allegedly doctored images and data in 35 research papers in which Zlokovic is the sole common author. It also raised questions about findings in Phase II clinical trials of a drug called 3K3A-APC, an experimental stroke treatment sponsored by ZZ Biotech, the Houston-based company Zlokovic co-founded.

Preclinical data appeared to have been manipulated, the report authors allege. In addition, the Phase II results appear to contain errors that would skew interpretation of the data in favor of the drug.

Stanford neuroscientist Robert Sapolsky poses for a photo at his home in San Francisco, California on Friday, October 13, 2023. Sapolsky's latest book, Determined, argues that we have no free will whatsoever. After 40 decades studying humans and other primates, Sapolsky has concluded that many factors beyond our control influence our choices and behaviors leaving free will to be negligible in any context.

Science & Medicine

Stanford scientist, after decades of study, concludes: We don’t have free will

You may think you chose to read this, but Stanford scientist Robert Sapolsky would disagree. He says virtually all human behavior is beyond our conscious control.

Oct. 17, 2023

An attorney for Zlokovic said the neuroscientist takes the accusations “extremely seriously” and was “committed to fully cooperating” with a USC inquiry into the matter. However, he said his client could not comment on the allegations while the review was pending.

“Professor Zlokovic would normally welcome addressing every question raised, insofar as allegations are based on information and premises Professor Zlokovic knows to be completely incorrect,” attorney Alfredo X. Jarrin wrote in an email. “And other questions address work not performed at his lab or papers where he was not the senior author or contact author and his role was limited.”

The university also issued a statement saying it takes allegations of research integrity seriously. “Consistent with federal regulations and USC policies , the university forwards any such allegations to its Office of Research Integrity for careful review,” the university said in a statement. “Under USC policy, this review is required to be confidential. As a result, we are unable to provide any further information.”

Last year, USC’s Keck School of Medicine received from NIH the first $4 million of a planned $30-million grant to conduct Phase III trials of the experimental stroke treatment on 1,400 people.

Given the serious issues outlined in their report, the whistleblowers say those trials should be stopped immediately.

“It should certainly be paused in my opinion,” said Matthew Schrag, an assistant professor of neurology at Vanderbilt and co-author of the whistleblower report. “There are red flags about the safety of that treatment.”

He said that evidence from the USC-led phase II trial of the drug, which was published in 2018 and called RHAPSODY, raised questions of patient safety. Patients in that trial were more likely to die in the week after treatment, and more likely to be disabled 90 days later than those who were given a placebo.

In addition, Schrag said, some patients given the placebo had to wait longer for the standard stroke treatment of the drug tPA or surgery to dissolve the blood clot.

“The faster you’re able to intervene to either restore blood flow with the drug or restore blood flow by removing the clot, the more brain cells survive,” he said.

He added that he did not believe the delay was intentional but that it had the effect of “skewing the results in favor of the drug.”

Schrag previously raised questions about the integrity of other neurological research, work he said was separate from his employment at Vanderbilt.

A CVS Pharmacy store is seen, Friday, Nov 4, 2022, in Boston. (AP Photo/Michael Dwyer)

Picking up a prescription? 6 tips to avoid dangerous pharmacy errors

Every year, millions of Californians leave the pharmacy with the wrong drugs or dosages. Don’t let it happen to you.

Sept. 5, 2023

Scientists have questioned Zlokovic’s research anonymously for years, Schrag said. Many of these concerns were published on PubPeer, a website on which anonymous contributors can examine scientific papers and highlight potential flaws.

Yet scientists working with Zlokovic did not complain publicly, he said, allowing the studies to continue for years and succeed at attracting tens of millions of dollars in taxpayer funding.

“I think people are concerned about the potential for backlash for harm to their own careers,” Schrag said. “And so I think that motivates people to just go along.”

In its report, the journal Science interviewed four former employees of Zlokovic’s lab who said that Zlokovic routinely pressured them to manipulate data. Two said they were told to discard notebooks with results that didn’t fit preferred conclusions he hoped to reach.

“There were clear examples of him instructing people to manipulate data to fit the hypothesis,” one former employee told the journal.

The severity of the data manipulation charges merits a thorough investigation of Zlokovic’s data, said Elisabeth Bik , a microbiologist and scientific integrity consultant who co-wrote the whistleblower report.

“Appropriate steps would be for USC to ask Zlokovic to give them the lab’s notebooks and data,” Bik said. “For example, for images where it appears that certain parts might have been duplicated or erased, the original images as they came off a scanner or microscope need to be compared to the published figure panels.”

Bik is among a subset of the report’s authors who are considering filing a federal whistleblower lawsuit. Should the NIH deem that any federal grant money was used improperly, a successful suit would entitle the plaintiffs to a portion of the money the government can claw back.

Zlokovic has received roughly $93 million in NIH funding, according to Science. A spokesperson for NIH’s Office of Extramural Research would not comment on the specifics of the case.

“We take concerns related to research integrity very seriously, and this may include allegations of research misconduct ,” the office said in a statement.

IRVINE, CA - JUNE 16: Irvine Clinical Research, located in the Alzheimer's Orange County building, on Friday, June 16, 2023 in Irvine, CA. Irvine Clinical Research is a for-profit, private company, recruiting seniors with memory problems for clinical trials of experimental Alzheimer's drugs. The company recruits people to its office inside a building owned by the non-profit group Alzheimer's Orange County. (Gary Coronado / Los Angeles Times)

Alzheimer’s drug trials target older Californians. Do they understand what they’re signing up for?

A gold rush in Alzheimer’s pharmaceutical research raises questions about whether aging seniors being recruited for trials in California understand the process and possible risks.

July 10, 2023

Over the years, Zlokovic has created several biotech companies aimed at commercializing his scientific work. In 2007, he co-founded ZZ Biotech, which has been working to gain federal approval of 3K3A-APC.

Last year, Kent Pryor, ZZ Biotech’s chief executive, called the drug “a potential game-changer.”

“I believe, based on the positive clinical results to date, our 3K3A-APC will potentially create the first new drug class to treat ischemic stroke since 2003,” Pryor said.

On Tuesday, Pryor declined to comment on the details in the whistleblowers’ report. “I don’t want to get into particular explanations right now because of the ongoing investigations,” he said.

He said the Phase III clinical trial had not yet begun.

Zlokovic is a leading researcher on the blood-brain barrier, with particular interest in its role in stroke and dementia. He received his medical degree and doctorate in physiology at the University of Belgrade and joined the faculty at USC’s Keck School of Medicine after several fellowships in London.

A polyglot and amateur opera singer , Zlokovic left USC and spent 11 years at the University of Rochester before returning in 2011 . He was appointed director of USC’s Zilkha Neurogenetic Institute the following year.

“My role will be to enhance an already very strong neuroscience base and try to make USC the No. 1 place in the neurosciences in the country and the world,” Zlokovic said upon rejoining the USC faculty. “It’s a big goal, but I think, with what’s going on right now, it’s actually moving in that direction. I think that could be my greatest contribution.”

php assign data

Corinne Purtill is a science and medicine reporter for the Los Angeles Times. Her writing on science and human behavior has appeared in the New Yorker, the New York Times, Time Magazine, the BBC, Quartz and elsewhere. Before joining The Times, she worked as the senior London correspondent for GlobalPost (now PRI) and as a reporter and assignment editor at the Cambodia Daily in Phnom Penh. She is a native of Southern California and a graduate of Stanford University.

php assign data

Melody Petersen is an investigative reporter covering healthcare and business for the Los Angeles Times. Send her tips securely on Signal at (213) 327-8634.

More From the Los Angeles Times

FILE - Residents wearing face masks line up behind barricaded tapes for COVID mass testing near a residential area on May 15, 2022, in Beijing. The World Health Organization says it’s made an official request to China for information about a potentially worrying spike in respiratory illnesses and clusters of pneumonia in children. (AP Photo/Andy Wong, File)

World & Nation

WHO asks China for more information on rise in cases of respiratory illness and pneumonia

Nov. 23, 2023

LOS ANGELES, CA - JANUARY 11, 2023 - - Veterinarian Dr. Kwane Stewart, known as, "The Street Vet,'' checks the heart rate of a puppy owned by a homeless man living in Skid Row in Los Angeles on January 11, 2023. Dr. Kwane, from San Diego, visits Skid Row twice a month to treat the dogs and cats of the homeless. Dr. Stewart has more than twenty years of experience and is the founder of Project Street Pet, a nonprofit organization devoted to caring for the lives of the homeless. (Genaro Molina / Los Angeles Times)

Thinking of the dog park? Think twice: Mystery dog illness in L.A. spurs warnings by officials

Nov. 22, 2023

A cholera patient lies on a hospital bed, in Harare, Zimbabwe, Sunday Nov. 19, 2023. A cholera outbreak in Zimbabwe is suspected of killing more than 150 people and infecting more than 8,000. The virulent bacterial disease is striking fear in many in the southern African country who live in impoverished and neglected areas where sanitation conditions are poor and local government failures have left them with no access to clean water. (AP Photo/Tsvangirayi Mukwazhi)

A cholera outbreak in Zimbabwe is suspected of killing more than 150, infecting thousands

Nov. 20, 2023

Sun Valley, CA - October 31: Stone countertop fabricator creates a cloud of dust while wearing a mask to help protect against airborne particles which can contribute to silicosis at a shop on Tuesday, Oct. 31, 2023 in Sun Valley, CA. (Brian van der Brug / Los Angeles Times)

California countertop workers died of a preventable disease. The threat was known years earlier

Nov. 19, 2023

PHP Tutorial

Php advanced, mysql database, php examples, php reference, php sessions.

A session is a way to store information (in variables) to be used across multiple pages.

Unlike a cookie, the information is not stored on the users computer.

What is a PHP Session?

When you work with an application, you open it, do some changes, and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end. But on the internet there is one problem: the web server does not know who you are or what you do, because the HTTP address doesn't maintain state.

Session variables solve this problem by storing user information to be used across multiple pages (e.g. username, favorite color, etc). By default, session variables last until the user closes the browser.

So; Session variables hold information about one single user, and are available to all pages in one application.

Tip: If you need a permanent storage, you may want to store the data in a database .

Start a PHP Session

A session is started with the session_start() function.

Session variables are set with the PHP global variable: $_SESSION.

Now, let's create a new page called "demo_session1.php". In this page, we start a new PHP session and set some session variables:

Note: The session_start() function must be the very first thing in your document. Before any HTML tags.


Get PHP Session Variable Values

Next, we create another page called "demo_session2.php". From this page, we will access the session information we set on the first page ("demo_session1.php").

Notice that session variables are not passed individually to each new page, instead they are retrieved from the session we open at the beginning of each page ( session_start() ).

Also notice that all session variable values are stored in the global $_SESSION variable:

Another way to show all the session variable values for a user session is to run the following code:

How does it work? How does it know it's me? Most sessions set a user-key on the user's computer that looks something like this: 765487cf34ert8dede5a562e4f3a7e12. Then, when a session is opened on another page, it scans the computer for a user-key. If there is a match, it accesses that session, if not, it starts a new session.

Modify a PHP Session Variable

To change a session variable, just overwrite it:

Destroy a PHP Session

To remove all global session variables and destroy the session, use session_unset() and session_destroy() :

PHP Exercises

Test yourself with exercises.

Create a session variable named "favcolor".

Get Certified



Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

[email protected]

Top Tutorials

Top references, top examples, get certified.


  1. Creating Database Tables with phpMyAdmin

    php assign data

  2. How to assign multiple variables at once in PHP

    php assign data

  3. phpmyadmin Tutorial 08

    php assign data

  4. Complete Guide and Tutorials for PHP Variables & Data type with example

    php assign data

  5. Complete Guide and Tutorials for PHP Operators with example

    php assign data

  6. 016 Add Data using PHP

    php assign data


  1. PHP Variables

    It is created the moment you first assign a value to it. Think of variables as containers for storing data. PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for PHP variables: A variable starts with the $ sign, followed by the name of the variable

  2. php

    10 Answers Sorted by: 101 There are quite a few ways to work with dynamic arrays in PHP. Initialise an array: $array = array (); Add to an array: $array [] = "item"; // for your $arr1 $array [$key] = "item"; // for your $arr2 array_push ($array, "item", "another item"); Remove from an array:

  3. PHP: Assignment Operators

    Assignment by reference means that both variables end up pointing at the same data, and nothing is copied anywhere. Example #1 Assigning by reference <?php $a = 3; $b = &$a; // $b is a reference to $a print "$a\n"; // prints 3 print "$b\n"; // prints 3 $a = 4; // change $a

  4. PHP: Variable variables

    Instancing a class normally (not through a variable) does not require the namespace. This seems to establish the pattern that if you are using an namespace and you have a class name in a string, you must provide the namespace with the class for the PHP engine to correctly resolve (other cases: class_exists(), interface_exists(), etc.) <?php

  5. PHP: Passing by Reference

    The syntax is as follows: <?php function foo(&$var) { $var++; } $a=5; foo($a); // $a is 6 here ?> Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. The following things can be passed by reference: Variables, i.e. foo ($a)

  6. Assigning returned data to a variable from function with PHP and PDO

    I have a problem with classes in PHP, I want to assign values received from the database to a private variable so that I can then use them in class functions. But in doing so I get the error: Fatal error: Constant expression contains invalid operations in ..\database.php on line 21. Here is my code:

  7. How to assign a PHP variable from MySQL data

    php mysql assigning variables to column data. 0. Assigning Variables from Array in MySQL Database. 2. PHP: How can variables be assigned values from a MySQL Query? 0. declare and give value to variables stored in a table. Hot Network Questions How can I install a garage door without the overhead rail hardware?

  8. PHP: The Basics

    When assigning an already created instance of a class to a new variable, the new variable will access the same instance as the object that was assigned. ... First, think of variables in PHP as data slots. Each one is a name that points to a data slot that can hold a value that is one of the basic data types: a number, a string, a boolean, etc ...

  9. Assign MySQL database value to PHP variable

    php mysql database variables assign Share Follow asked Mar 20, 2014 at 0:26 M.G.Poirot 1,086 2 11 22 yes, exactly... query () returns a result HANDLE, not the data you were querying. You need to FETCH a row of results, e.g. $row = mysql_fetch_asssoc ($result). - Marc B Mar 20, 2014 at 0:29

  10. php

    1 Answer Sorted by: 0 $current_date = new DateTime ('2011-08-10'); $current_date->modify ('+1 day'); //next day $current_date->modify ('-1 day');// prev day $other_date = new DateTime ('1970-01-01'); //another date See DateTime reference UPDATE:

  11. How do I assign a value to a variable in PHP?

    All you need to do is use the "=" (equal sign) operator. For example, if you have a variable named "myVariable" and you want to assign the value "Hello, PHP!" to it, you would write: php $myVariable = "Hello, PHP!" ; That's it! The value "Hello, PHP!" is now stored in the variable "myVariable".

  12. How to declare a global variable in php?

    10 Answers Sorted by: 294 The $GLOBALS array can be used instead: $GLOBALS ['a'] = 'localhost'; function body () { echo $GLOBALS ['a']; } From the Manual: An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.

  13. How to assign a number to a variable in PHP

    It would appear you are building a web shop platform of sorts. I'd opt to pass the product id as a value, then have PHP query the product details, and the exact price. If you don't: it's a piece of cake for me to alter the request data and send "12" or even "1" as the value, which you use as price back to the server. Anyway: sending back the ...

  14. php

    1 To assign a variable simply means to make a value available under another name. So no, it does not matter whether you run mysql_real_escape_string () on $username or on $_POST ['username'] as long as you keep using one of those options consequently within their scope. - Quasdunk Jan 29, 2012 at 0:12 Thanks for your great comments.

  15. Object Assignment in PHP

    Object Assignment in PHP Ask Question Asked 11 years, 1 month ago Modified 11 years, 1 month ago Viewed 5k times Part of PHP Collective 8 First, sorry for the stupid question, but I was reading an article in and I couldn't understand what exactly it says.

  16. PHP: settype

    Example #1 settype () example <?php $foo = "5bar"; // string $bar = true; // boolean settype($foo, "integer"); // $foo is now 5 (integer) settype($bar, "string"); // $bar is now "1" (string) ?> Notes ¶ Note: Maximum value for "int" is PHP_INT_MAX . See Also ¶

  17. PHP Date and Time

    Get a Date The required format parameter of the date () function specifies how to format the date (or time). Here are some characters that are commonly used for dates: d - Represents the day of the month (01 to 31) m - Represents a month (01 to 12) Y - Represents a year (in four digits) l (lowercase 'L') - Represents the day of the week

  18. 38 PHP Date & Time Functions (& How to Use Them)

    That's why we've put together this list of date and time functions so you can quickly reference them as needed while programming. We've also included a brief review of how to obtain date and time values and how to set a timezone for your PHP project. How to Get the Date & Time in PHP. There are two ways to obtain the date and time in PHP.

  19. After Israel-Hamas hostage deal, an agonizing wait for the release of

    5 min. JERUSALEM — War-shattered families in Israel and Gaza woke to a hopeful-but-agonizing limbo Wednesday, following the early-hours approval of a deal between Israel and Hamas. The agreement ...

  20. Earth just passed a feared global warming milestone for the first time

    November 19, 2023 at 8:01 p.m. EST. A woman passes a man resting on the tires of a truck at a warehouse and storage site during a heat wave in São Paulo, Brazil, on Friday. (Amanda Perobelli ...

  21. USC neuroscientist faces scrutiny following allegations of data

    The report identifies allegedly doctored images and data in 35 research papers in which Zlokovic is the sole common author. It also raised questions about findings in Phase II clinical trials of a ...

  22. PHP Data Types

    PHP supports the following data types: String Integer Float (floating point numbers - also called double) Boolean Array Object NULL Resource PHP String A string is a sequence of characters, like "Hello world!". A string can be any text inside quotes. You can use single or double quotes: Example Get your own PHP Server <?php $x = "Hello world!";

  23. PHP Arrays

    In PHP, the array () function is used to create an array: array (); In PHP, there are three types of arrays: Indexed arrays - Arrays with a numeric index Associative arrays - Arrays with named keys Multidimensional arrays - Arrays containing one or more arrays Get The Length of an Array - The count () Function

  24. PHP Numbers

    PHP Numbers. One thing to notice about PHP is that it provides automatic data type conversion. So, if you assign an integer value to a variable, the type of that variable will automatically be an integer. Then, if you assign a string to the same variable, the type will change to a string. This automatic conversion can sometimes break your code.

  25. PHP Sessions

    A session is started with the session_start () function. Session variables are set with the PHP global variable: $_SESSION. Now, let's create a new page called "demo_session1.php". In this page, we start a new PHP session and set some session variables: